another question about forms

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

yesterday i was been suggested by the group to use
msgForm = New Form3()
Application.Run(msgForm)

It works fine and the form is displayed. however, the application does not
go further unless i close the form, WHICH I DO NOT WANT. In essence, the
purpose of this particular form in the application is to give user a
continous feedback of what the application is doing currently by continiously
changing

msgForm.Label1.Text = "Opening CAD, Please wait ..."

Similarly, at some other stage
msgForm.Label1.Text = "Copying Layouts, Please wait ..."

and similarly another 2-3 messages, informing the user about other things
that the application is doing.

To reinstate my question again, i want the application NOT to stop at
Application.Run(msgForm)
but continiouly run the code and at the same time continue to show the form
Is their anyother way that i can achieve this.
TIA
irfan
 
If I understand correctly, You need a Main Form that will be instantiated
the way described earlier.

This main form will instantiate the msgForm using

msgForm = New Form3()
msgForm.Show()

Incase you dont need Multiple Forms you might wanan move the the processing
code in the Main form.
Also Please note that incase your code is multithreaded, you should not
update form's controls from a thread other than its own thread.
You will need to use Invoke to run the code on the same thread of form, that
accesses the controls on it.

Or do you want a Splash Form ? ( Like the ones that Visual Studio .NET and
other apps have - a form which is shown and gets updated with information
will the main form is loaded ) ?

Sorry for most of the suggestions are based on assumptions. A lil more
information about your problem will b helpful.

HTH
rawCoder
 
thanks for the reply.... It is not like a splash screen because the splash
screen usualy closes when application starts.

All i want is that the form remains displayed, once displayed it should not
wait for an input from user( because its only purpose is to display messages
and it has no controls of its own except for a label) but continue to run the
rest of the code.

Please give me any ideas.
 
Well from the top of my head.

Use the same technique specified earlier.

And in the Form_Load event initialize/run the business logic processing that
you want to perform.

I am not sure whether your business logic is plain code or some event based
code and how intensive the processing is.
But incase you simply want to notify a user when a checkpoint is passed, you
can use this method.

Like
in FormLoad
me.label1.text="Opening CAD"
OpenCad()
me.label1.text="Processing Layout"
ProcessLayout()
...
...

Do note that if the processing is intensive your form will not respond which
means that it might not paint properly.
In that case you need to run your business logic on separate thread and then
handle the accessing gui from other thread issue.

HTH
rawCoder
 

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

Back
Top