You are viewing our Forum Archives. To view or take place in current topics click here.
Need VB help (Simple)
Posted:

Need VB help (Simple)Posted:

Pink_Unicorn
  • New Member
Status: Offline
Joined: Oct 06, 201212Year Member
Posts: 12
Reputation Power: 0
Status: Offline
Joined: Oct 06, 201212Year Member
Posts: 12
Reputation Power: 0
Im very very new to vb and I'm doing a project in class where you enter in 2 letter codes and it will pump out info. I need how to make a error message in a message box if they type in a incorrect code.
#2. Posted:
speed
  • Winter 2020
Status: Offline
Joined: Jun 11, 200915Year Member
Posts: 9,897
Reputation Power: 3160
Motto: "I'l no I grew up to fast speed I no u will be little famous" - Famous_Energy
Motto: "I'l no I grew up to fast speed I no u will be little famous" - Famous_Energy
Status: Offline
Joined: Jun 11, 200915Year Member
Posts: 9,897
Reputation Power: 3160
Motto: "I'l no I grew up to fast speed I no u will be little famous" - Famous_Energy
I usually don't provide code when you show no effort, but here you go...


        If TextBox1.Text = "a" Or TextBox1.Text = "b" Then
            MessageBox.Show("Success")
        Else
            MessageBox.Show("Wrong text entered", "Program name", MessageBoxButtons.OK, MessageBoxIcon.Error)
        End If


Checks to see if a or b is entered, if not, it shows an error message.
#3. Posted:
GGR
  • TTG Senior
Status: Offline
Joined: Apr 25, 201113Year Member
Posts: 1,295
Reputation Power: 55
Status: Offline
Joined: Apr 25, 201113Year Member
Posts: 1,295
Reputation Power: 55
Little error handling

Runs only if a charector is entered and can't be left blank

If textbox1.text <>"" then

Runs this code

Else
Msgbox("please enter a letter in text box")
Jump to:
You are viewing our Forum Archives. To view or take place in current topics click here.