title: Random Number Guessing Game for Visual Basic 6.0
body: <p>I'm trying to make a program that will generate a random number, and you have to guess it by typing in the answer. The problem is that it won't match the right number <a href="http://i.stack.imgur.com/2OEwt.jpg/%22as%20shown" rel="nofollow">as shown</a>.</p>
  
  <p>Objects:
  2 Labels, 1 textbox, 1 Command button</p>
  
  <p>My first code:</p>
  
  <pre><code>Private Sub Command1_Click()
  Dim Num, Random As Integer
  
  Label2.Caption = ""
  Num = Val(Text1.Text)
  Randomize (Random)
  Random = Val(Label1.Caption)
  Label1.Caption = Int(10 * Rnd + 1)
  
  For Num = 1 To Num
      If Num = Random Then
      Label2.Caption = "you won "
      Else
      End If
  Next
  End Sub
  </code></pre>