Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Showing Modal Form...

Status
Not open for further replies.

skinrock

Programmer
Nov 20, 2004
23
US
So far I have a login and sign up section for this project I'm working on. I wanted to use a method that would pevent the user from opening multiple instances of the sign up and login forms. At first, I was thinking of loading the forms normally, and just running a check to see what MDI children the parent forms contain, but I can't figure out how to tell what form they are. So, my other idea was loading the form modally. With the login, there is one form, so I just say:
Code:
Dim frm As New frmLogIn
frm.ShowDialog()
it works fine, you can't interact with the parent form until you do something with the login. Now, the problem is, my sign up involves three forms. The first form works fine, I use the same method as above, but when I try to use it when the user hits "Next", even though I added a close statement, the next form loads on top of it and locks out the parent form, the same way the original one does. The code is:
Code:
Dim frm As New frmLoginInfo
Me.Close()
frm.ShowDialog()
Is there a way to override this modal attribute, or should I somehow implement the original idea regarding checking for existing forms? Thanks!
 
take care of all of the form opening/closing from your primary form:

Code:
dim frmLogon1 as new frmLogon
dim frmLoginInfo1 as new frmLoginInfo
frmLogon1.showdialog
frmLogonInfo1.showdialog

since the first form is modal, the second form won't get shown untill it closes.

-Rick

----------------------
 
I don't really follow. The next button is an object in the modal form, it doesn't trigger anything in the parent/original form. I don't get how the parent form will know when the user hits the "next" button in the child/modal form. Would I maybe want to create a function in a module?
 
Control is maintained by the parent form. The parent form launches the first form modal. That means progress on the parent form is halted until the modal form is closed. So the cursor will sit at the frmLogon1.showdialog line until the user hit's next. On the frmLogon btnNext.Click event close frmLogon. This will return control to the parent form. The next line that is run is frmLogonInfo1.showdialog which does the same.

-Rick

----------------------
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top