[VB] help in vb 2010

Discussion in 'Mixed Languages' started by stevemk14ebr, Feb 22, 2011.

  1. stevemk14ebr

    stevemk14ebr MDL Senior Member

    Jun 23, 2010
    267
    48
    10
    i need help in vb 2010 im trying to check what number someone entered into a textbox against a predetermined variable of 13 in an if statement to display a text box or another textbox
    this is just a simple little thing as im just learning




    currently its:
    Public Class frmmain
    'creaes a global variable by the name of myname with a value of 13
    Dim myname As Byte = 13
    Dim txtanswer = Me.txtbox.Text











    Private Sub btnOK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOK.Click
    ' comparing the 2 variables myname and txtanswer to see if myname is smaller than txtanswer
    If myname < txtanswer Then
    MessageBox.Show("hello kid")
    Else : MessageBox.Show("hello oldie")


    End If
    End Sub
    End Class
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  2. dogskool

    dogskool MDL Novice

    Apr 29, 2011
    1
    0
    0
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    Dim textAnswer As Integer
    textAnswer = TextBox1.Text
    If textAnswer > 13 Then
    Label2.Text = "hello oldie"
    Else
    Label2.Text = " hello kid"
    End If
    End Sub

    * When you run the program and enter a number that is greater than 13, the statement "hello oldie" will be shown. On the other hand, if the number entered is less than or equal to 13, you will see the "hello kid" statement

    Check here for help:
    vbtutor net