Zebra0.com

visual-basic examplesProfessor Joy: CA125 Class Work

Professor Joy: CA125 Class Work

Class Work Week 9

Break a name as Last,First into First and Last. Display error if no comma.
Private Sub BtnName_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnName.Click
        Dim s As String = InputBox("Enter last,first")
        Dim First, Last As String
        Dim comma As Integer = s.IndexOf(",")
        If comma < 0 Then
            MsgBox("Name must have a comma!", MsgBoxStyle.Critical + MsgBoxStyle.OkOnly, "ERROR")
        Else
            Last = s.Substring(0, comma)
            First = s.Substring(comma + 1)
            Me.Text = First & " " & Last
        End If
End Sub

This web site, and all pages therein, are the sole property and responsibility of Zebra0.com.
It is not endorsed, sponsored, or provided by or on behalf of Montgomery College.