DUMB Module question

R

RSH

I have create a simple module and a couple forms. I have it set to run the
module when the application starts. Several variables are set and then a
form object is instantiated and displayed. The problem is that the
application doesnt pause when the form displays...instead it simply quits
right after the form is displayed. Why doesn't it simply pause after the
form is displayed?

Module Code:
sub main()

Dim f1 As New Form1

f1.Show()

f1.TextBox1.Text = "Test Text To Display

Application.DoEvents()

end sub
 
M

Mythran

RSH said:
I have create a simple module and a couple forms. I have it set to run the
module when the application starts. Several variables are set and then a
form object is instantiated and displayed. The problem is that the
application doesnt pause when the form displays...instead it simply quits
right after the form is displayed. Why doesn't it simply pause after the
form is displayed?

Module Code:
sub main()

Dim f1 As New Form1

f1.Show()

f1.TextBox1.Text = "Test Text To Display

Application.DoEvents()

end sub

Sub Main()
Dim f1 As Form1 = New Form1()
f1.TextBox1.Text = "Test Text To Display"
Application.Run(f1)
End Sub

HTH :)

Mythran
 
P

Phill. W

RSH said:
the application doesnt pause when the form displays...

Make sure you use Application.Run(), not Form.Show() to get the
form up and running; this sets up a "Message Loop" for it to run
around in; without this, as you've seen, the application has no reason
to stay running.

HTH,
Phill W.
 
R

RSH

Thanks! As you might imagine this definitely worked!

I had a real tough time grasping the concept of a form as an object...and it
got real blurry when working with the codebehind of the form. I think i
like the conept of the modules running the show and leveraging the forms as
what they are...forms.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top