locked
Don't work RRS feed

  • Question

  • why don't works this code, I can't see what wrong is

    Private Sub Afsluiten_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Afsluiten.Click

    Dim Response As MsgBoxResult

    If TextBox1.Text <> "" Then

    MsgBox("Opslaan?", MsgBoxStyle.YesNo)

    End If

    If Response = MsgBoxResult.Yes Then

    OpslaanFunc()

    Else

    End

    End If

     

    End Sub

    Saturday, November 12, 2005 4:37 PM

Answers

  • I prefer to use messagebox.show instead of msgbox.  I never have had to double click this way



            Dim drResponse As DialogResult

            drResponse = MessageBox.Show("Are you sure?", "", MessageBoxButtons.YesNo)

            If drResponse = Windows.Forms.DialogResult.Yes Then
                ' your code goes here
            End If


     

    Saturday, November 12, 2005 10:24 PM

All replies

  • You never gave response a value.  Try something like response = msgbox("Opslann?", MsgboxStyle.YesNo). 
    Saturday, November 12, 2005 5:50 PM
  • now works it only with double click by the msgBox how can I set it to oneclick
    Saturday, November 12, 2005 6:35 PM
  • I prefer to use messagebox.show instead of msgbox.  I never have had to double click this way



            Dim drResponse As DialogResult

            drResponse = MessageBox.Show("Are you sure?", "", MessageBoxButtons.YesNo)

            If drResponse = Windows.Forms.DialogResult.Yes Then
                ' your code goes here
            End If


     

    Saturday, November 12, 2005 10:24 PM
  • This code will achieve what you need.




    Public Class Form1
        Private Sub Afsluiten_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Afsluiten.Click
            If TextBox1.Text <> "" Then
                If MsgBox("Opslaan?", MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then
                    OpslaanFunc()
                Else
                    Application.Exit()
                End If
            End If
        End Sub
    End Class

     


    Dustin.
    Saturday, November 12, 2005 11:12 PM
  • It works thank you
    Sunday, November 13, 2005 1:17 PM