Visual Basic Development Bookmark and Share   
 Home > Visual Basic Language > How to make Modal Form that isn't TopLevel?
 

How to make Modal Form that isn't TopLevel?

I need to make a call to a form that stops code flow until the form returns control to the program. Like what a Modal form would do but with a form that is parented to another form or control.

Currently I am making the call and then looping until a boolean is set that signals the form is finished. There has to be a better way of doing this.

Darin Clark  Monday, March 03, 2008 4:42 AM

I found the way. First it requires the program to run on a separate thread from the user interface. Then use a AutoResetEvent lets say we call it RoadBlock

Afterthe controller shows the form then the programstops for RoadBlock.WaitOne.

When the form is finished and ready to return control to the program then weRoadBlock.Set in the form.

The hardest part is keeping the threads straight.

Darin Clark  Tuesday, March 04, 2008 1:33 AM

I found the way. First it requires the program to run on a separate thread from the user interface. Then use a AutoResetEvent lets say we call it RoadBlock

Afterthe controller shows the form then the programstops for RoadBlock.WaitOne.

When the form is finished and ready to return control to the program then weRoadBlock.Set in the form.

The hardest part is keeping the threads straight.

Darin Clark  Tuesday, March 04, 2008 1:33 AM

You can use google to search for other answers

Custom Search

More Threads

• Encryption/Decryption using webservice in vb.net
• Richtextbox control
• Is it possible to read the information from Internet Explorer's Favourite Folder
• clearing textbox in gridview?
• Obtain day name passing a number
• Using Tool Tips in VB .net 2005
• Change treeview icon at runtime
• checkbox column
• Transparent Window
• Calling a Click Event