Modal form in a modal form???

Jerre

New member
Joined
Dec 5, 2006
Messages
4
Location
Belgium => Hove
Programming Experience
Beginner
I am making a simple game and for a "battlescreen" I need to have a modal form (the battle screen) in a modal form (the levelmap).

This is what i have
VB.NET:
If Guy.Top = 20 And Guy.Left = 40 Then
                If MsgBox("Grab your weapon, there's an enemy up there!", MsgBoxStyle.OKOnly, "Prepare for a battle") = MsgBoxResult.OK Then
                    Dim Bttl As BattleScreen
                    If Bttl.ShowDialog(Me) = System.Windows.Forms.DialogResult.OK Then
                    End If
                End If
            End If
It doesn't work the way I've written it now and it doesn't work without the messagebox. If there's a way to have a modal form in a modal form, please tell me.
 
A form is a form. If you want to show a form modally you call its ShowDialog method plain and simple. You can have a chain of as many forms as you like that each call the next one's ShowDialog method.

If you're saying that you want to open the BattleScreen form from the MessageBox then that's not possible with the MessageBox class. You'd have to create your own form class to use in place of the MessageBox.

If you mean that you actually want a modal form INSIDE a parent form then that's impossible. An MDI child form cannot be modal.
 
Back
Top