Reputation: 150
I write a program in Visual Basic, which doesn't need - and doesn't have - a GUI unless a certain event happens, in which the user needs to be involved (and a MsgBox wouldn't suffice). Now I want to call a form (which I have already created in the project) from my code. So I want to call
Public Class MyForm
{...} 'In my case empty
End Class
from within
Module MyMain
{...} 'do unrelated stuff
'Call MyForm somehow
{...} 'proceed stuff, knowing users input
End Module
I see the form for a very brief moment, but I can't get my program to halt and wait for me, while I am in the form. The code in my desperation is:
Module MyMain
{...} 'do unrelated stuff
Dim wifo As New MyForm()
wifo.Show()
wifo.Visible = True
wifo.Activate()
wifo.Focus()
{...} 'proceed stuff, knowing users input
End Module
How does one do it?
Upvotes: 1
Views: 127
Reputation: 4940
If I understand you correctly, you want the Form.ShowDialog() method...
https://msdn.microsoft.com/en-us/library/c7ykbedk(v=vs.110).aspx
Upvotes: 1