Home All Groups Group Topic Archive Search About

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

Author
2 Dec 2006 8:35 PM
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

Author
2 Dec 2006 11:14 PM
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
--------------------------
Show quoteHide quote
"Suzanna" <marc_cro***@hotmail.com> wrote in message
news:1165091707.387310.161970@j72g2000cwa.googlegroups.com...
> 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
>
Author
3 Dec 2006 10:02 AM
Suzanna
Great that worked...thank you very much
Ken Tucker [MVP] wrote:
Show quoteHide quote
> 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
> --------------------------
> "Suzanna" <marc_cro***@hotmail.com> wrote in message
> news:1165091707.387310.161970@j72g2000cwa.googlegroups.com...
> > 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
> >