OpenFileDialog - TROUBLE

xcorp

Freshman
Joined
Jul 10, 2003
Messages
35
Location
bc canada
Hey guys,

I'm a bit of a newb with Visual Basic. Anyway, I'm currently playing around with deleting and modifying controls. I've created a program where you have to enter a path location for a file you would like to delete and then press a botton to delete it using the "KILL" command.

I wanted to expand this program, so I'm trying to add a "BROWSE" function instead of having to type the entire file location yourself manually into the text box.

It would make it alot easier and practical (even though I know you could just select the file in windows and hit the delete key).

I'm trying to use an "OpenFileDialog" I dunno if thats the write thing to do. My father whos a programmer suggest I use an API Call to do it. But i'm fooling around and I discovered OpenFileDialog.

I dunno how do run it though. I can't figure out how to run the diolog and then, when the user chooses a file, how to put the path of that file in Textbox1.text.

ANY HELP WOULD HELP!!!
 
-EDIT-
Derek, your EliteVB class parsing thing seems to be broken. ASP.NET server error. :-\
-EDIT-

Try something like this:
Visual Basic:
Dim ofd As New OpenFileDialog

ofd.ShowDialog()
If (ofd.FileName.Length > 0) Then
  TextBox1.Text = ofd.FileName
End If
Remember, you can always look in your MSDN help file for information about all the .NET controls.
 
Yeah, the nimrods that call themselves Web hosts seem to have misplaced any sign of intelligence. I'm working on getting it up again. I've replaced it with a link straight to the MSDN class library reference.
[edit]MSDN7ITR is working again. Link reverted.[/edit]
 
Last edited:
Thanks for all your help guys!!

And umm. Volteface - I tried out your code. And when I click the button, still.. nothing happens. The dialog doesn't come up or anything.. :(


Dunno what I should do, so I'm gonna try using the system.windows.form open dialog thing.
 
Back
Top