Visual Basic 6 Small Program Check me and Help me :)

Discussion in 'Programming' started by skaterboi1234, Aug 1, 2010.

  1. #1
    Hi
    I want to develop program in Visual Basic 6, is a small program that lets you input any number from 1 to 5 and automatically display the corresponding number to its row. I have some screenshots i finish the design, my problem is the coding part. please help..here's my print screen screenshots. I have an screenshots below.
     

    Attached Files:

    skaterboi1234, Aug 1, 2010 IP
  2. mcfox

    mcfox Wind Maker

    Messages:
    7,526
    Likes Received:
    716
    Best Answers:
    0
    Trophy Points:
    360
    #2
    Sorry, I haven't looked at your code (you would be better just pasting the bit of code) but wouldn't you be better using the latest version of VB? You can download Visual Basic Studio 2010 Express for free from Microsoft.
    http://www.microsoft.com/express/downloads/
     
    mcfox, Aug 1, 2010 IP
  3. skaterboi1234

    skaterboi1234 Peon

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Private Sub Text1_Change()
    If Val(Text1.Text) = "5" Then
    val(text1.Text) = label5.caption
    End If
    End Sub

    i need the right code sir thanks....
     
    skaterboi1234, Aug 1, 2010 IP
  4. lonewolff

    lonewolff Member

    Messages:
    338
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    30
    #4
    Sounds like homework :)
     
    lonewolff, Aug 1, 2010 IP
  5. mcfox

    mcfox Wind Maker

    Messages:
    7,526
    Likes Received:
    716
    Best Answers:
    0
    Trophy Points:
    360
    #5
    mcfox, Aug 1, 2010 IP
  6. skytide

    skytide Peon

    Messages:
    25
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    This is pretty simple. On the text change event just code it so that it checks for the input in the textbox. If it equals 1 to 5, then enter that in the corresponding textbox. You can use a case statement:

    Select Case youmaintextbox.text
    Case "1"
    textbox1.text = "1"
    Case "2"
    textbox2.text = "2"
    End Case

    Just add the cases for 3, 4, and 5. You can also do if/else statements like

    If youmaintextbox.text = "1" Then textbox1.text = "1"
    ElseIf youmaintextbox.text = "2" Then textbox1.text = "2"
    End If
     
    skytide, Aug 2, 2010 IP
  7. skaterboi1234

    skaterboi1234 Peon

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Thanks sir.....
     
    skaterboi1234, Aug 3, 2010 IP
  8. ctol2s

    ctol2s Peon

    Messages:
    1
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #8
    A little correction:

    Select Case youmaintextbox.text
    Case "1"
    label1.caption = "1"
    Case "2"
    label2.caption = "2"
    Case "3"
    label3.caption = "3"
    Case "4"
    label4.caption = "4"
    Case "5"
    label5.caption = "5"
    End Case
     
    ctol2s, Aug 17, 2010 IP