Showing results for 
Search instead for 
Did you mean: 

How I can open file dialog in B1?

Former Member
0 Kudos


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


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,


Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Thank you ,Eddy

Former Member
0 Kudos

try this, it should work:

Dim ofd As New OpenFileDialog

Dim nw As New NativeWindow

nw.AssignHandle(System.Diagnostics.Process.GetProcessesByName("SAP Business One")(0).MainWindowHandle)


Product and Topic Expert
Product and Topic Expert
0 Kudos


The forum you have posted your question in is for questions related to the SAP Business One integration for SAP NetWeaver. Your question seems to be related to the SAP Business One SDK. You should post your question in the SAP Business One SDK Forum as you may get a faster response.

With respect to your question ... have a look at this link as it may assist you with your question ...