As per what I understand from your question is that
You need to browse for selecting a Database file
So as per me why don't you use a openfiledialog control
and open this on a Browse Button click
Filter the openfiledialog for database files.and then you can select the
required files from there.May this can give you a start.
Private Sub BtnBrowse_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnBrowse.Click
Using OpenFileDialog As OpenFileDialog = Me.GetOpenFileDialog()
If (OpenFileDialog.ShowDialog(Me) = DialogResult.OK) Then
TxtFileName.Text = OpenFileDialog.FileName
Else
Exit Sub
End If
End Using
End Sub
Here TxtFileName is a textBox which shows the selected file.Below is the function to filter the openFileDialog.
Private Function GetOpenFileDialog() As OpenFileDialog
Dim openFileDialog As New OpenFileDialog
openFileDialog.CheckPathExists = True
openFileDialog.CheckFileExists = True
openFileDialog.Filter = "SQL data files (*.mdf)|*.mdf"
openFileDialog.Multiselect = False
openFileDialog.AddExtension = True
openFileDialog.ValidateNames = True
openFileDialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Desktop)
Return openFileDialog
End Function
That's all Try This.I am not an Expert But may this can help you out.You can Search Google for Filtering Database File inside Openfiledialog.I have just provided you here One.