BP Forums
Why dusn't this code Work? - Printable Version

+- BP Forums (https://bpforums.info)
+-- Forum: Archived Forums (https://bpforums.info/forumdisplay.php?fid=55)
+--- Forum: Archived Forums (https://bpforums.info/forumdisplay.php?fid=56)
+---- Forum: VB.NET (Visual Basic 2010/2008) (https://bpforums.info/forumdisplay.php?fid=8)
+----- Forum: Programming Help (https://bpforums.info/forumdisplay.php?fid=9)
+----- Thread: Why dusn't this code Work? (/showthread.php?tid=461)



Why dusn't this code Work? - Aaron Rogers118 - 02-17-2012

Code:
Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        If CheckBox1.Checked = True Then
            MessageBox.Show("TEST", "TEST", MessageBoxButtons.OK)
        Else
            MessageBox.Show("TEST", "TEST", MessageBoxButtons.OKCancel)
            If MessageBoxButtons.Cancel = Click Then
                MessageBox.Show("Are you shor you want to quit?", "TEST", MessageBoxButtons.YesNo, MesssageBoxIcon.Question)
                If MessageBoxButtons.Yes = Click Then
                    End
                End If
            End If
        End If

    End Sub
End Class



Re: Why dusn't this code Work? - zmanalpha - 02-18-2012

Sorry to hear you're having trouble, here is a corrected version of that.(Note there's probably a million other ways to do this.)

Code:
If CheckBox1.Checked = True Then
            MsgBox("Test", MsgBoxStyle.OkOnly, "Test")
        Else
            If MsgBox("test", MsgBoxStyle.OkCancel, "test") = MsgBoxResult.Cancel Then
                If MsgBox("Are You Sure?", MsgBoxStyle.YesNo, "Test") = MsgBoxResult.Yes Then
                    Me.Close()
                End If
            End If
        End If



Re: Why dusn't this code Work? - brandonio21 - 02-19-2012

Yes, I am pretty sure that ZManAlpha has the correct version, but be sure to test it and make sure that it does everything you need it to!


Re: Why dusn't this code Work? - Aaron Rogers118 - 02-21-2012

IT WORKS!!!!! Thanks!