Answer to Question #301049 in Visual Basic for Vhenz

Question #301049

Programming Tasks:

1. Write a program that will determine if one or both textboxes for username and

password contains empty string. If username or/and password is/are empty then it will

display a message that username and password is required. Otherwise, it will determine

if it correct or incorrect.

2. Write a program implementing Select Case statement that evaluates a character either a

vowel or a consonant.

3. Write a program implementing While loop statement, any Do loops statement, any For

loops statement that display your Name, School, Course and Year level 10 times with

the use of message box.


1
Expert's answer
2022-02-22T13:06:40-0500

Program 1




Public Class Form1


    Private Sub btnCheck_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCheck.Click
        If txtUserName.Text = String.Empty Then
            MessageBox.Show("Username is required.")
            Return
        End If
        If txtPassword.Text = String.Empty Then
            MessageBox.Show("Password is required.")
            Return
        End If


        If txtUserName.Text = "admin" And txtPassword.Text = "1111" Then
            MessageBox.Show("Correct")
        Else
            MessageBox.Show("Incorrect")
        End If


    End Sub
End Class




Program 2.


Module Module1


    Sub Main()




        Console.Write("Enter the letter: ")
        Dim letter As String = Console.ReadLine()




        Select Case letter.ToUpper()
            Case "A", "E", "I", "O", "U"
                Console.WriteLine("Vowel")
            Case Else
                Console.WriteLine("Consonant")
        End Select


        Console.ReadLine()
    End Sub


End Module


Program 3.
Public Class Form1


    Private Sub btnCheck_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCheck.Click
        Dim info As String = ""
        Dim counter As Integer = 0


        'While loop statement
        While counter < 10
            info += "Your Name: Your Name" + Environment.NewLine 'School, Course and Year level"
            info += "Your School: 45" + Environment.NewLine
            info += "Your Course: VB.NET" + Environment.NewLine
            info += "Your Year level: 3" + Environment.NewLine + Environment.NewLine
            counter += 1
        End While
        MessageBox.Show(info)
        'Do loops statement
        info = ""
        counter = 0
        Do Until counter >= 10
            info += "Your Name: Your Name" + Environment.NewLine 'School, Course and Year level"
            info += "Your School: 45" + Environment.NewLine
            info += "Your Course: VB.NET" + Environment.NewLine
            info += "Your Year level: 3" + Environment.NewLine + Environment.NewLine
            counter += 1
        Loop
        MessageBox.Show(info)
        'For loops statement that display  10 times with the use of message box.
        For i As Integer = 0 To 9
            info += "Your Name: Your Name" + Environment.NewLine 'School, Course and Year level"
            info += "Your School: 45" + Environment.NewLine
            info += "Your Course: VB.NET" + Environment.NewLine
            info += "Your Year level: 3" + Environment.NewLine + Environment.NewLine
        Next
        MessageBox.Show(info)


    End Sub
End Class




Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS