Click here to Skip to main content
15,887,214 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Give info regarding Graphics Pin
Dave Kreskowiak31-Dec-07 4:15
mveDave Kreskowiak31-Dec-07 4:15 
Generalhelp to use outlook express in coding Pin
Senthil S29-Dec-07 0:36
Senthil S29-Dec-07 0:36 
GeneralRe: help to use outlook express in coding Pin
Dave Kreskowiak29-Dec-07 6:43
mveDave Kreskowiak29-Dec-07 6:43 
GeneralRe: help to use outlook express in coding Pin
Paul Conrad29-Dec-07 6:53
professionalPaul Conrad29-Dec-07 6:53 
QuestionDisabling keyboard access in dataGridView? Pin
Benny_Lava28-Dec-07 22:39
Benny_Lava28-Dec-07 22:39 
GeneralSecurity levels/user access control in windows form application Pin
tellytub28-Dec-07 18:19
tellytub28-Dec-07 18:19 
GeneralRich Text Box query: embedding SQL record id's in text Pin
Ned Rifle28-Dec-07 17:06
Ned Rifle28-Dec-07 17:06 
General911 Emergency - Lost in the sauce Pin
Dee Kay28-Dec-07 16:34
Dee Kay28-Dec-07 16:34 
I am a middle aged internet college student trying to get some assistance a Case problem for my course. I have ask for help from instructor, but due to the holidays he has not replied to any of my queries. My assignment is due no later midnight on the 28 of Dec 07. I am stuck like chuck...

Project Name: Random Number Game
Scope: Create an VB.Net app that allows the user to guess a random number generated by the computer. When the user makes an incorrect guess, the application should move an image up or down depending on how the guess compares to the random number. If the random number is greater that users guess the image shoould move upwards to indicate to the user to guess higher. Same with a lesser guess but the image moves lower indcate the user shoul guess lower. The game ends when the user guesss the random number. If the usershould opt to end the game early the random number should be displayed.

I have been able to create a text indicator version of this game without the early termination criteria. I have come to an impass. Snippet of code of functioning code below:

---------------------------------------
Option Strict On
Option Explicit On

Imports System.Globalization

Public Class mainForm

Private Sub startButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles startButton.Click

Dim randomGenerator As New Random
Dim inputString As String
Dim input As Integer
Dim random As Integer
Dim isConverted As Boolean
Const Prompt As String = "Enter guess"
Const Title As String = "Guess a number"
'Dim cancel As DialogResult = Windows.Forms.DialogResult.Cancel ' Case usage
'Dim ok As DialogResult = Windows.Forms.DialogResult.OK ' Case usage
'Dim choice As DialogResult

' primer read - not needed program work fine without it
'input = 0

'generate random number from 1 t0 10
random = randomGenerator.Next(1, 11)

' Begin Loop
Do

'input guess
inputString = InputBox(Prompt, Title, "0")

'Select Case choice
' Case Windows.Forms.DialogResult.Cancel
'If Windows.Forms.DialogResult.Cancel = cancel Then
'input = random
'MessageBox.Show("The number was " & random, "Answer", MessageBoxButtons.OK)

'End If
' Case Windows.Forms.DialogResult.OK
'If Windows.Forms.DialogResult.OK = ok Then
isConverted = Integer.TryParse(inputString, input)
If isConverted = True Then

'if input is integer then execute loop
If input > random Then
displayLabel.Text = "Guess lower"
ElseIf input < random Then
displayLabel.Text = "Guess Higher"
Else : input = random
displayLabel.Text = random & " is correct"
End If
Else

MessageBox.Show("Enter a number between 1 and 10")
End If
'End If
'End Select



'End Select
Loop Until input = random ' End Loop
'-----------------------------------------------------------

'display correct guess
'If input = random Then
'MessageBox.Show("You are correct") 'alternate method of correct guess display
'displayLabel.Text = random & " is correct"
'End If

End Sub
End Class

You will notice that I remarked out my all my Case structure, when I add them the program ceases to function properly. Any help would be appreciated, I have waited to the last minute because I thought I woulde get the help I needed from my instructor. Thanks in advance to any who care to respond. Frown | :(
GeneralRe: 911 Emergency - Lost in the sauce Pin
MikeMarq28-Dec-07 21:34
MikeMarq28-Dec-07 21:34 
GeneralRe: 911 Emergency - Lost in the sauce Pin
Dee Kay29-Dec-07 2:22
Dee Kay29-Dec-07 2:22 
GeneralRe: 911 Emergency - Lost in the sauce Pin
MikeMarq29-Dec-07 7:07
MikeMarq29-Dec-07 7:07 
GeneralRe: 911 Emergency - Lost in the sauce Pin
Dee Kay29-Dec-07 12:59
Dee Kay29-Dec-07 12:59 
GeneralRe: 911 Emergency - Lost in the sauce Pin
Dee Kay29-Dec-07 15:32
Dee Kay29-Dec-07 15:32 
GeneralRe: 911 Emergency - Lost in the sauce Pin
MikeMarq29-Dec-07 20:21
MikeMarq29-Dec-07 20:21 
GeneralPutting .ico files on buttons Pin
Benny_Lava28-Dec-07 2:12
Benny_Lava28-Dec-07 2:12 
GeneralRe: Putting .ico files on buttons Pin
eyes200728-Dec-07 2:49
eyes200728-Dec-07 2:49 
GeneralRe: Putting .ico files on buttons Pin
Paul Conrad28-Dec-07 11:00
professionalPaul Conrad28-Dec-07 11:00 
GeneralRe: Putting .ico files on buttons Pin
Sun Rays28-Dec-07 22:21
Sun Rays28-Dec-07 22:21 
Generalprinting a different report Pin
eyes200728-Dec-07 1:41
eyes200728-Dec-07 1:41 
GeneralRe: printing a different report Pin
jhoga28-Dec-07 3:53
jhoga28-Dec-07 3:53 
Questionhelp help Pin
Member 475249028-Dec-07 1:32
Member 475249028-Dec-07 1:32 
GeneralMultiple violations! Pin
leckey28-Dec-07 5:14
leckey28-Dec-07 5:14 
GeneralRe: Multiple violations! Pin
Paul Conrad28-Dec-07 10:59
professionalPaul Conrad28-Dec-07 10:59 
GeneralRe: Multiple violations! Pin
leckey28-Dec-07 11:11
leckey28-Dec-07 11:11 
QuestionShowing custom controls? Pin
Benny_Lava27-Dec-07 22:36
Benny_Lava27-Dec-07 22:36 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.