-
Jun 6th, 2006, 12:32 AM
#1
Thread Starter
Addicted Member
Browse button!!!!
hi guys,
i need to make a browse button which when clicked should open a window where i can search the file that i need to open. it is the same function that we normally see in MS word or other tools.
thanks.
-
Jun 6th, 2006, 12:35 AM
#2
Addicted Member
-
Jun 6th, 2006, 12:46 AM
#3
Thread Starter
Addicted Member
Re: Browse button!!!!
i dont know what is that. actually i need to make a menubar. in vb.net its menustrip. i need to make a similar menubar as of MS word.
-
Jun 6th, 2006, 12:47 AM
#4
Re: Browse button!!!!
Just add a Button control to your form, double-click it to create a Click event handler and then display an OpenFileDialog. You can add the OpenFileDialog to the form in the designer or you can create one in code on demand. I'd be inclined to use the designer as setting the properties is easier but if you want to do it in code it would look something like this:
VB Code:
Private Sub browseButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles browseButton.Click
Using ofd As New OpenFileDialog
ofd.Filter = "All files (*.*)|*.*"
ofd.Title = "Select File"
If ofd.ShowDialog() = Windows.Forms.DialogResult.OK Then
MessageBox.Show("You selected " & ofd.FileName)
End If
End Using
End Sub
Note that this is VB 2005 and will not work as is in previous versions. Please specify your version in future.
-
Jun 6th, 2006, 12:49 AM
#5
Re: Browse button!!!!
OK, MenuStrip means you're using VB 2005. So, do you want a button or a menu? Either way you can still handle the Click event of a ToolStripMenuItem (menu) or a ToolStripButton (tool bar) so it's the same thing.
-
Jun 6th, 2006, 12:52 AM
#6
Thread Starter
Addicted Member
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|