ofdGetNetPath.ShowDialog
When I run the setup on Vista, and click the button to open the openFileDialog, it hanged, form becomes non responsive and I have to cancel the setup.
on debugging I got following error
"Current thread must be set to single thread apartment (STA) mode before OLE calls can be made. Ensure that your main function has STAThreadAttribute marked in it. This exception is only raised if a debugger is attached to the process."
so I used the following code:
Expand|Select|Wrap|Line Numbers
- Dim ofdThread As Thread
- ofdThread = New Thread(New ThreadStart(AddressOf ShowOpenFileDialog))
- ofdThread.SetApartmentState(ApartmentState.STA)
- ofdThread.Start()
- Private Sub ShowOpenFileDialog()
- Me.ofdGetNetPath.ShowDialog()
- End Sub