Skip to main content

 HOW TO USE MESSAGE BOX TO DISPLAY OUTPUT FROM A SELECTION CASE IN VB




Public Class Form1
    Dim mark As Double
    Private Sub txtTest_TextChanged(sender As Object, e As EventArgs) Handles txtTest.TextChanged

    End Sub

    Private Sub btnok_Click(sender As Object, e As EventArgs) Handles btnok.Click
        mark = Double.Parse(txtTest.Text)

        Select Case (mark)
            Case 0 To 49
                MsgBox("Fail!", MsgBoxStyle.Information, "COMMENT")
            Case 50 To 64
                MsgBox("Pass", MsgBoxStyle.Information, "COMMENT")
            Case 65 To 74
                MsgBox("Credit", MsgBoxStyle.Information, "COMMENT")
            Case 75 To 100
                MsgBox("Distinction", MsgBoxStyle.Information, "COMMENT")
            Case < 0
                MsgBox("Invalid! Cannot be less than 0", MsgBoxStyle.Information, "COMMENT")
            Case > 100
                MsgBox("Invalid! Cannot be greater than 100", MsgBoxStyle.Information, "COMMENT")
        End Select

    End Sub
End Class


Comments

Popular posts from this blog

The computer scientist responsible for copy,  cut and paste passes away.  The advent of the personal computer wasn’t just about making these powerful machines available to everyone, it was also about making them accessible and usable, even for those lacking a computer science degree. Larry Tesler, who passed away on Monday, might not be a household name like Steve Jobs or Bill Gates, but his contributions to making computers and mobile devices easier to use are the highlight of a long career influencing modern computing. Born in 1945 in New York, Tesler went on to study computer science at Stanford University, and after graduation he dabbled in artificial intelligence research (long before it became a deeply concerning tool) and became involved in the anti-war and anti-corporate monopoly movements, with companies like IBM as one of his deserving targets. In 1973 Tesler took a job at the Xerox Palo Alto Research Center (PARC) where he worked until 1980. Xerox PARC is famou...