Sunday, May 15, 2011

Open File Title in TextBox

If you want to enter the file title in TextBox using visual basic 2010 in one button write the code bellow:



       Dim dialog As OpenFileDialog = New OpenFileDialog()
        dialog.Title = "Test File Dialog"
        dialog.InitialDirectory = "D:\Users\Admin\Desktop"
        dialog.Filter = "All files (*.*)|*.*|All files (*.*)|*.*"
        dialog.FilterIndex = 2
        dialog.RestoreDirectory = True
        If dialog.ShowDialog() = DialogResult.OK Then
            TextBox1.Text = dialog.FileName
        End If

No comments:

Post a Comment

There was an error in this gadget