VB.net Dhowdialog form close on clicking on message box

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
 
A

Armin Zingler

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top