Need some Simple Help knowing when a form is accepted???????????

S

Suzanna

Hi Guys,

I am trying to use the below code to open a messgae box when the OK
button is clicked on a dialog form. Its not working though.

The dialogue form is a separate form with just a single OK button
attached. I have set the dialogaccept to OK on the button etc.

Private Sub RenameToolStripMenuItem_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
RenameToolStripMenuItem.Click
Dialog1.Show()
Dialog1.Location = ContextMenuStrip1.SourceControl.Location
If Dialog1.DialogResult = Windows.Forms.DialogResult.OK Then
MsgBox("hhh")
End If

End Sub
 
K

Ken Tucker [MVP]

Hi,

Use showdialog to show the form to get a resultback

Dim dr as DialogResult = Dialog1.ShowDialog()
Dialog1.Location = ContextMenuStrip1.SourceControl.Location
If dr = Windows.Forms.DialogResult.OK Then
MsgBox("hhh")
End If

Ken
 
S

Suzanna

Great that worked...thank you very much
Ken said:
Hi,

Use showdialog to show the form to get a resultback

Dim dr as DialogResult = Dialog1.ShowDialog()
Dialog1.Location = ContextMenuStrip1.SourceControl.Location
If dr = Windows.Forms.DialogResult.OK Then
MsgBox("hhh")
End If

Ken
 

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