Hi. I'm new to the VB language but I'm familiar with programming/scripting.

I'm also new to these forums so please forgive me if this post is in the wrong board.

I started playing with Visual Basic when I realized my tech school had it installed on the network computers, and became a bit addicted (within a few days) of the possibilities it contains.

I've started writing something basic.. a number guessing game in a Windows Application. The layout may not be optimal/strategically formed, because I'm not familiar with the language yet.

Here's the code:

vb Code:
  1. Public Class Form1
  2.  
  3.     Public Rand As Integer = 0
  4.     Public Attempts As Integer = 5
  5.  
  6.     Public Function DoFail()
  7.         MsgBox("You failed. The number was: " + Rand)
  8.         Attempts = 0
  9.         Return 1
  10.     End Function
  11.  
  12.     Private Sub Button1_Click() Handles Button1.Click
  13.         If Rand < 1 Then
  14.             Randomize()
  15.             Rand = Int(Rnd() * 11)
  16.             If Rand = 0 Then
  17.                 Rand += 1
  18.             End If
  19.         End If
  20.         If GuessBox.Text = 0 Then
  21.             MsgBox("You must enter a guess!", MsgBoxStyle.Exclamation, "Guess")
  22.         Else
  23.             Dim Guess As Integer = GuessBox.Text
  24.             If Guess > Rand Then
  25.                 Attempts -= 1
  26.                 If Attempts = 0 Then
  27.                     DoFail()
  28.                 End If
  29.                 StatusStrip1.Text = "Remaining attempts: " + Attempts
  30.                 OutputBox.Text = "Lower!"
  31.             End If
  32.             If Guess < Rand Then
  33.                 Attempts -= 1
  34.                 If Attempts = 0 Then
  35.                     DoFail()
  36.                 End If
  37.                 StatusStrip1.Text = "Remaining attempts: " + Attempts
  38.                 OutputBox.Text = "Higher!"
  39.             End If
  40.             If Guess = Rand Then
  41.                 StatusStrip1.Text = "Winner!"
  42.                 MsgBox("You've got it! The number was: " + Rand, MsgBoxStyle.Information, "Winner!")
  43.                 Me.Close()
  44.             End If
  45.         End If
  46.     End Sub
  47. End Class

When I attempt to run this, the dialog opens fine. Until I click the "Guess" (Button1) button, which sort of freezes the dialog, returning me to the Visual Basic editor debugger. If the guessed number matches the random number (or if its lower or higher) then it returns the related code (involving the integers 'Rand' and 'Guess'):

If Guess > Rand:
vb Code:
  1. StatusStrip1.Text = "Remaining attempts: " + Attempts
  2.  
  3. 'This line is highlighted with this message:
  4. 'Conversion from string "Remaining attempts: " to type 'Double' is not valid.

If Guess < Rand:
(same as above)

If Guess = Rand:
vb Code:
  1. MsgBox("You've got it! The number was: " + Rand, MsgBoxStyle.Information, "Winner!")
  2.  
  3. 'This line is highlighted with this message:
  4. 'Conversion from string "You've got it! The number was: " to type 'Double' is not valid.


What am I doing wrong?

Thanks in advanced.