This is the case:
My .NET application has a form as Startup Object.
My .NET application opens a Access .adp file and sends an
object to it so it can communicate with my .NET
application.
The Access file calls a sub in the .NET application to
open a form.
If the sub tries to open the form with .Show() it doesn't
work.
My resolution is to open the form with .ShowDialog() in a
thread. This works fine but why cant I just use .Show()?
Example code to open the form with a thread:
'***Open form as a thread
Public sub subOpenForm(ByVal oFormToOpen As
System.Windows.Forms)
Dim oOpenForm As clsOpenForm
Dim tOpenForm As Thread
oOpenForm = New clsOpenForm(oFormToOpen)
tOpenForm = New Thread(AddressOf
oOpenForm.subOpenForm)
tOpenForm.Start()
End Function
Private Class clsOpenForm
Private m_oFormToOpen As System.Windows.Forms =
Nothing
Public Sub New(ByRef oFormToOpen As
System.Windows.Forms)
m_oFormToOpen = oFormToOpen
End Sub
Public Sub subOpenForm()
m_oFormToOpen.ShowDialog()
End Sub
End Class
-----Original Message-----
Why can't I run .Show() on a System.Windows.Forms object
from a Class? The code works fine if i run it from an
other form.
The form gets visible but no controls are loaded and the
mouse pointer is an hourglass.
..ShowDialog() works fine.
.