Creating another simple program in Visual Basic 2015

Asked By 90 points N/A Posted on -
qa-featured

Can you help me with my simple program? This is how to display the message I placed to the text box and show response like you’re interacting with the computer. What are the tools that I need to use from the toolbox? How am I going to insert the codes or declarations as they say? Can you give me a sample program? How can I change the color of my window? Can I add few pictures or icons in my design?

SHARE
Answered By 0 points N/A #165052

Creating another simple program in Visual Basic 2015

qa-featured

Hello Janet!

This program is just easy to achieve and I know that you can do it without sweat. Let’s start, here are the requirements.

1. Form 1

2. 1 textbox >> change the name property to “strName”

3. 1 Command button

Here are the codes.

Public Class Form1

    Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click

        If strName.Text = "" Then

            MsgBox("Enter your name.")

        Else

            MsgBox("Hello " + strName.Text + ", how are you today?")

        End If

    End Sub

End Class

Notice that I used the If-Else-Statement? Why do I need to do that? The reason for that is to make it sure that the textbox will contain your name or any character before it goes on posting the message “Hello <your name>, how are you today?” Using statements will make you programs work like it is thinking on its own.

Notice also that I have to use “+” cross/plus sign? I used the symbol to combine the Message Box’s inputted message and adding the name or string that will be placed in to your text box.

Related Questions