We value your feedback.
Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!
Public Class frmproject5 Inherits System.Windows.Forms.Form Dim intNumberToGuess As Long Dim Count As Integer Dim Index As Integer Dim previousGuesses As New System.Collections.Hashtable Private Sub Button1_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnguess.Click Dim intGuess As Long Dim UpperBound As Long Dim LowerBound As Long 'check the number being entered into the textbox against the random number set If IsNumeric(txtguess.Text) Then intGuess = CLng(txtguess.Text) Else ' If no text enetered and button cliked, display message MsgBox("Enter a number into the textbox!") End If ' If the number being enetered is lower than the random number, Update() If Not (previousGuesses(intGuess) Is Nothing) Then lblinfo.Text() = "You've already tried this number - try again" MsgBox("You've already tried this number - try again") Else If intGuess < intNumberToGuess Then lblinfo.Text() = "Too Low!" MsgBox("Number is Too Low - Have another go!") ElseIf intGuess > intNumberToGuess Then lblinfo.Text = "Too High!" MsgBox("Number is Too High - Have another go!") ElseIf intGuess = intNumberToGuess Then lblinfo.Text = "You've Got It!" MsgBox("Well Done - You've worked out the random number - Now have another go!") intNumberToGuess = Int((UpperBound - LowerBound + 100) * Rnd() + LowerBound) End If 'Add the numbers guessed into the listbox listguess.Items.Add(txtguess.Text) previousGuesses(intGuess) = intGuess End If End Sub Private Sub btnhowtoplay_enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnhowtoplay.Click MsgBox("Type a number between 0 and 100 into the box labeled Type Guess Here. The program will generate a random number and will tell you if you've gone to high or to low, keep guessing until you are CORRECT!") End Sub Private Sub Btnreset_enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btnreset.Click listguess.Items.Clear() txtguess.Text = "" listguess.Text = "" lblinfo.Text = "" btnguess.Enabled = True Randomize() End Sub Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim intNumberToGuess As Long Dim UpperBound As Long Dim LowerBound As Long Randomize() intNumberToGuess = Int((UpperBound - LowerBound + 100) * Rnd() + LowerBound) End Sub End Class
Add your voice to the tech community where 5M+ people just like you are talking about what matters.
|Saving history changes to sub form||4||56|
I need help using System.Web.HttpUtility.Htm
|can this macro be converted to sub procedure||4||34|
|how to read data from all excel sheet and copy it in in Master sheet||2||28|
Join the community of 500,000 technology professionals and ask your questions.