Here is a weird one that locks up both my program and the IDE. It's VB6. Can anyone explain the behavior described below? (and please, no one say you can't have 2 modal forms at the same time, you can, I do it all the time)
1. Create a DLL project.
2. Add a form, place a command button on the form, change command button's caption to "hide me", add this code:
Private Sub Command1_Click()
Me.Hide
End Sub
3. add this method to your class:
Public Sub RunForm()
Form1.Show vbModal
End Sub
4. Compile it
5. Create a new StandardEXE project w/ 2 forms. Change the project name (can't leave them both as Project1), and then Reference the dll you just compiled.
6. Add a button to Form1, set its caption to "run Form2 modally", and this code:
Private Sub Command1_Click()
Form2.Show vbModal
End Sub
7. Add a button to Form2, set button's caption to "open component dialog modally", and add this code:
Private o As New Class1 'general declarations
Private Sub Command1_Click()
o.RunForm
End Sub
Private Sub Form_Load()
o.RunForm
End Sub
8. SAVE THE PROJECT! (last chance!!!!!)
9. Run the project, press the "run Form2 modally" button. Before the Form2 can open, it opens up the component's modal form via it's Load event. Press the "hide me" button on this form. The 2nd form will come up now. Press its "open component dialog modally" button to bring up the component's modal form again. Try to do anything. All you will get are annoying beeps. The application has hung.
10. Pull out all of your hair because you cannot debug in the IDE because that too is nonresponsive.
I have 4 years of VB5 & 6 experience, but this one is baffling me. If either Form2 or the component's form were not called modal, it doesn't hang. If you don't call o.RunForm from the Form_Load event of Form2, then you can call it as many times as you want from the button. I can probably work around this, but I would really like to know what is going on.
1. Create a DLL project.
2. Add a form, place a command button on the form, change command button's caption to "hide me", add this code:
Private Sub Command1_Click()
Me.Hide
End Sub
3. add this method to your class:
Public Sub RunForm()
Form1.Show vbModal
End Sub
4. Compile it
5. Create a new StandardEXE project w/ 2 forms. Change the project name (can't leave them both as Project1), and then Reference the dll you just compiled.
6. Add a button to Form1, set its caption to "run Form2 modally", and this code:
Private Sub Command1_Click()
Form2.Show vbModal
End Sub
7. Add a button to Form2, set button's caption to "open component dialog modally", and add this code:
Private o As New Class1 'general declarations
Private Sub Command1_Click()
o.RunForm
End Sub
Private Sub Form_Load()
o.RunForm
End Sub
8. SAVE THE PROJECT! (last chance!!!!!)
9. Run the project, press the "run Form2 modally" button. Before the Form2 can open, it opens up the component's modal form via it's Load event. Press the "hide me" button on this form. The 2nd form will come up now. Press its "open component dialog modally" button to bring up the component's modal form again. Try to do anything. All you will get are annoying beeps. The application has hung.
10. Pull out all of your hair because you cannot debug in the IDE because that too is nonresponsive.
I have 4 years of VB5 & 6 experience, but this one is baffling me. If either Form2 or the component's form were not called modal, it doesn't hang. If you don't call o.RunForm from the Form_Load event of Form2, then you can call it as many times as you want from the button. I can probably work around this, but I would really like to know what is going on.