VB.net Dhowdialog form close on clicking on message box

  • Thread starter Thread starter genius.jain
  • Start date Start date
G

genius.jain

HI i am opening a form as showdialog

In amin form MDI
Private Sub ToolStripMenuItem5_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles ToolStripMenuItem5.Click
Try
Dim _ConnConfig As New ConnConfig
_ConnConfig.ShowDialog()
Catch ex As Exception
MsgBox(ex.Message)
End Try

End Sub

Now suppose i generate a msgbox on connconfig form then if i click on
msg box ok my form
closes why
In conn config form
Private Sub command1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles command1.Click
msgbox "hi"
end sub


Problem : on clicking Ok on msgbox Form closes
It wont close if in main form i open as _ConnConfig.Show() instead
of _ConnConfig.ShowDialog()

Regards
Abhishek Jain
 
HI i am opening a form as showdialog

In amin form MDI
Private Sub ToolStripMenuItem5_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles ToolStripMenuItem5.Click
Try
Dim _ConnConfig As New ConnConfig
_ConnConfig.ShowDialog()
Catch ex As Exception
MsgBox(ex.Message)
End Try

End Sub

Now suppose i generate a msgbox on connconfig form then if i click
on msg box ok my form
closes why
In conn config form
Private Sub command1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles command1.Click
msgbox "hi"
end sub


Problem : on clicking Ok on msgbox Form closes
It wont close if in main form i open as _ConnConfig.Show() instead
of _ConnConfig.ShowDialog()


In ConnConfig, what is the value of the DialogResult property of Command1?
If it is not "None", then the Form automatically closes if you click the
button (because the DialogResult property of the Form is set automatically,
which exits ShowDialog).


Armin
 
Back
Top