Skip to Content
0
Former Member
Jun 19, 2007 at 06:10 AM

How I can open file dialog in B1?

904 Views

Hi

I must to create upload picture button and when Button_click it has file dialog to open. Now I use this VB Code

Dim myStream As Stream

Dim openFileDialog1 As New OpenFileDialog

openFileDialog1.InitialDirectory = "c:\"

openFileDialog1.Filter = "txt files (.txt)|.txt|All files (.)|."

openFileDialog1.FilterIndex = 2

openFileDialog1.RestoreDirectory = True

If openFileDialog1.ShowDialog() = DialogResult.OK Then

myStream = openFileDialog1.OpenFile()

If Not (myStream Is Nothing) Then

myStream.Close()

End If

End If

Result, it open file dialog behind B1. How I can open file dialog on B1?. Please give me advice or example.

best regards,

tosaporn