Hello,
I am trying to set up a File Browser Dialog so that a user can select a text file for reading. When the dialog opens I want the user to be able to select the folder and the file and then for that path to be shown in a text box. What I don't get is how to browse to a file. I can browse to the directory and display that just fine, the problem is displaying the file. Is there some property of FileBrowserDialog that I can set for this?
I am using .net 2003. Thanks for the help
I am trying to set up a File Browser Dialog so that a user can select a text file for reading. When the dialog opens I want the user to be able to select the folder and the file and then for that path to be shown in a text box. What I don't get is how to browse to a file. I can browse to the directory and display that just fine, the problem is displaying the file. Is there some property of FileBrowserDialog that I can set for this?
VB.NET:
[SIZE=2][/SIZE][SIZE=2][COLOR=#0000ff]Private[/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff]Sub[/COLOR][/SIZE][SIZE=2] Button1_Click([/SIZE][SIZE=2][COLOR=#0000ff]ByVal[/COLOR][/SIZE][SIZE=2] sender [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] System.Object, [/SIZE][SIZE=2][COLOR=#0000ff]ByVal[/COLOR][/SIZE][SIZE=2] e [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] System.EventArgs) [/SIZE][SIZE=2][COLOR=#0000ff]Handles[/COLOR][/SIZE][SIZE=2] Button1.Click
[/SIZE][SIZE=2][COLOR=#0000ff]With[/COLOR][/SIZE][SIZE=2] FolderBrowserDialog1
.RootFolder = Environment.SpecialFolder.Desktop
.SelectedPath = "c:\"
[/SIZE][SIZE=2][COLOR=#0000ff]If[/COLOR][/SIZE][SIZE=2] .ShowDialog = DialogResult.OK [/SIZE][SIZE=2][COLOR=#0000ff]Then
[/COLOR][/SIZE][SIZE=2]TextBox1.Text = .SelectedPath
[/SIZE][SIZE=2][COLOR=#0000ff]End[/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff]If
[/COLOR][/SIZE][SIZE=2][/SIZE][SIZE=2][COLOR=#0000ff]End[/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff]With
[/COLOR][/SIZE][SIZE=2][/SIZE][SIZE=2][COLOR=#0000ff]End[/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff]Sub
[/COLOR][/SIZE]
I am using .net 2003. Thanks for the help