13 Replies - 9042 Views - Last Post: 28 November 2009 - 11:15 AM Rate Topic: -----

#1 EndLessMind  Icon User is offline

  • These are the droids you're looking for
  • member icon

Reputation: 194
  • View blog
  • Posts: 1,099
  • Joined: 13-March 09

SaveFileDialog

Posted 28 November 2009 - 10:30 AM

Hi. How do i get the selected path with a savefiledialog without the filename?
Is This A Good Question/Topic? 0
  • +

#3 LeisureProgrammer  Icon User is offline

  • N00by VB.NET Developer
  • member icon

Reputation: 110
  • View blog
  • Posts: 588
  • Joined: 06-September 09

Re: SaveFileDialog

Posted 28 November 2009 - 10:33 AM

Try something like this:

  SaveFileDialog1.ShowDialog()
		Dim blah As String = SaveFileDialog1.FileName
		Dim meh As Integer = blah.LastIndexOf("\")
		Dim lala As String = blah.Substring(0, meh)
		dim yourPath as string = lala


This post has been edited by LeisureProgrammer: 28 November 2009 - 10:34 AM

Was This Post Helpful? 1
  • +
  • -

#4 EndLessMind  Icon User is offline

  • These are the droids you're looking for
  • member icon

Reputation: 194
  • View blog
  • Posts: 1,099
  • Joined: 13-March 09

Re: SaveFileDialog

Posted 28 November 2009 - 10:47 AM

View PostLeisureProgrammer, on 28 Nov, 2009 - 09:33 AM, said:

Try something like this:

  SaveFileDialog1.ShowDialog()
		Dim blah As String = SaveFileDialog1.FileName
		Dim meh As Integer = blah.LastIndexOf("\")
		Dim lala As String = blah.Substring(0, meh)
		dim yourPath as string = lala


hm. i got error on
 Dim lala As String = blah.Substring(0, meh)

saying something like "length cant be 0" not sure how to translate it becuse mine is in swedish.
Was This Post Helpful? 0
  • +
  • -

#5 LeisureProgrammer  Icon User is offline

  • N00by VB.NET Developer
  • member icon

Reputation: 110
  • View blog
  • Posts: 588
  • Joined: 06-September 09

Re: SaveFileDialog

Posted 28 November 2009 - 10:48 AM

Are you picking a file from the file dialog?
Was This Post Helpful? 0
  • +
  • -

#6 EndLessMind  Icon User is offline

  • These are the droids you're looking for
  • member icon

Reputation: 194
  • View blog
  • Posts: 1,099
  • Joined: 13-March 09

Re: SaveFileDialog

Posted 28 November 2009 - 10:50 AM

View PostLeisureProgrammer, on 28 Nov, 2009 - 09:48 AM, said:

Are you picking a file from the file dialog?

no. im using the savefiledialog to select path and file name for my filedownloader in my browser. so im selecting a path and entering a filename ( like "test.txt" )
Was This Post Helpful? 0
  • +
  • -

#7 LeisureProgrammer  Icon User is offline

  • N00by VB.NET Developer
  • member icon

Reputation: 110
  • View blog
  • Posts: 588
  • Joined: 06-September 09

Re: SaveFileDialog

Posted 28 November 2009 - 10:56 AM

That should work too - just make sure the variable is populated with a path-like thing - right after showing the savefiledialog, do this:
msgbox(savefiledialog1.filename)


Does the full path appear?

This post has been edited by LeisureProgrammer: 28 November 2009 - 10:59 AM

Was This Post Helpful? 0
  • +
  • -

#8 Deathx  Icon User is offline

  • New D.I.C Head

Reputation: 3
  • View blog
  • Posts: 45
  • Joined: 23-November 08

Re: SaveFileDialog

Posted 28 November 2009 - 10:56 AM

This should do it.

System.IO.Path.GetFileNameWithoutExtension(SaveFileDialogBox.FileName)


Was This Post Helpful? 0
  • +
  • -

#9 LeisureProgrammer  Icon User is offline

  • N00by VB.NET Developer
  • member icon

Reputation: 110
  • View blog
  • Posts: 588
  • Joined: 06-September 09

Re: SaveFileDialog

Posted 28 November 2009 - 10:59 AM

Deathx, that's the exact opposite of what he wants :)

EDIT: Deathx's code is waayy more efficient, use his :D

This post has been edited by LeisureProgrammer: 28 November 2009 - 11:04 AM

Was This Post Helpful? 0
  • +
  • -

#10 Deathx  Icon User is offline

  • New D.I.C Head

Reputation: 3
  • View blog
  • Posts: 45
  • Joined: 23-November 08

Re: SaveFileDialog

Posted 28 November 2009 - 11:02 AM

Heh sorry i read it wrong.

Then this should do it ;).

System.IO.Path.GetDirectoryName(SaveFileDialog.FileName)


Was This Post Helpful? 0
  • +
  • -

#11 EndLessMind  Icon User is offline

  • These are the droids you're looking for
  • member icon

Reputation: 194
  • View blog
  • Posts: 1,099
  • Joined: 13-March 09

Re: SaveFileDialog

Posted 28 November 2009 - 11:06 AM

Thanks DeathX :)
i dont know why i dont tried that one ^^
Was This Post Helpful? 0
  • +
  • -

#12 Deathx  Icon User is offline

  • New D.I.C Head

Reputation: 3
  • View blog
  • Posts: 45
  • Joined: 23-November 08

Re: SaveFileDialog

Posted 28 November 2009 - 11:07 AM

No problem :)
Was This Post Helpful? 0
  • +
  • -

#13 EndLessMind  Icon User is offline

  • These are the droids you're looking for
  • member icon

Reputation: 194
  • View blog
  • Posts: 1,099
  • Joined: 13-March 09

Re: SaveFileDialog

Posted 28 November 2009 - 11:07 AM

Could you plz take a look at an other problem of mine? :)
http://www.dreaminco...mp;#entry847418

The new name you just help me solve :)
Was This Post Helpful? 0
  • +
  • -

#14 Deathx  Icon User is offline

  • New D.I.C Head

Reputation: 3
  • View blog
  • Posts: 45
  • Joined: 23-November 08

Re: SaveFileDialog

Posted 28 November 2009 - 11:12 AM

I've read that and I'm sorry I cant be of any help there.
Was This Post Helpful? 0
  • +
  • -

#15 EndLessMind  Icon User is offline

  • These are the droids you're looking for
  • member icon

Reputation: 194
  • View blog
  • Posts: 1,099
  • Joined: 13-March 09

Re: SaveFileDialog

Posted 28 November 2009 - 11:15 AM

Okey. Thanks anyway :)
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1