Visual Basic Development Bookmark and Share   
 Home > Visual Basic IDE > Controlling a Modal form from a module
 

Controlling a Modal form from a module

Hi Geeks,

I have a situation where I need to display a Modal Window from a vb.net module and feed the contents to that modal form from the module.
I am showing the form, feeding data to it from a class module and trapping the events in it using a timer control from the module.
It works fine with Show() method but it doesn't with ShowDialog().
If I used ShowDialog() then I was not able to continue with the code followed by it and not able to update any contents in the modal form.

I am using VS2003 version.
Is there any workaround to this?
I appreciate your Ideas/guidance in this regard.

Thanks,
Ram
ram001  Tuesday, November 17, 2009 3:37 PM
That's part of the purpose of the ShowDialog is to stop execution in the main code until the dialog is dismissed.

There are several things you can do:

1) Pass the data (or whatever) you need to the dialog on the constructor.

2) Have the dialog call the module to execute the process it needs.

So instead of something like this:

form1.ShowDialog()
PerformCalculations()

You would instead do this:

form1.ShowDialog()

Then in the form Load event of form1:

PerformCalculations()

Hope this helps.
www.insteptech.com ; msmvps.com/blogs/deborahk
We are volunteers and ask only that if we are able to help you, that you mark our reply as your answer. THANKS!
DeborahK  Tuesday, November 17, 2009 4:14 PM
That's part of the purpose of the ShowDialog is to stop execution in the main code until the dialog is dismissed.

There are several things you can do:

1) Pass the data (or whatever) you need to the dialog on the constructor.

2) Have the dialog call the module to execute the process it needs.

So instead of something like this:

form1.ShowDialog()
PerformCalculations()

You would instead do this:

form1.ShowDialog()

Then in the form Load event of form1:

PerformCalculations()

Hope this helps.
www.insteptech.com ; msmvps.com/blogs/deborahk
We are volunteers and ask only that if we are able to help you, that you mark our reply as your answer. THANKS!
DeborahK  Tuesday, November 17, 2009 4:14 PM

You can use google to search for other answers

Custom Search

More Threads

• Problems with the Data Link Properties Dialog Box
• Need Help with TabControl / TabPage
• VS 6.0
• My VB 2008 form is Corroupt and Can't be loaded by the Designer
• Problem............Not sure about its nature.
• VS2005 Can't display Form in desgin mode
• platform targets in the configuration manager
• IDE Help!
• need help in making a bingo program.
• Warning As Errors