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

Visual Basic

 
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 
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 
Mike, Thanks for getting me to simplify things. I have a solution that meets the criteria. Unfortunatly it does not use the principals outlined in the chapter I am working on (Decisions and Loops). I have posted my solution below:

Option Strict On
Option Explicit On

Public Class mainForm
' declare variable for form
Dim random As Integer

Private Sub mainForm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'declare variable
Dim randomGenerator As New Random

'generate random number and direct focus to text box
random = randomGenerator.Next(1, 11)
inputTextBox.Text = "0"
inputTextBox.Focus()
End Sub

Private Sub startButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles startButton.Click
' decalre variables
Dim randomGenerator As New Random
Dim input As Integer
Dim isConverted As Boolean

'convert input and validate input
isConverted = Integer.TryParse(inputTextBox.Text, input)
If isConverted = True Then

'direct focus to text box
inputTextBox.Clear()
inputTextBox.Text = "0"
inputTextBox.Focus()


' Decision Tree
If input > random Then
pointPictureBox.SetBounds(82, 162, 100, 50)
displayLabel.Text = "Last Guess was " & input
input = 0
inputTextBox.Focus()

ElseIf input < random Then
pointPictureBox.SetBounds(82, 82, 100, 50)
displayLabel.Text = "Last Guess was " & input
input = 0
inputTextBox.Focus()

Else
pointPictureBox.SetBounds(82, 122, 100, 50)
displayLabel.Text = random & " is correct"
End If

Else

' if invalid iput then show
MessageBox.Show("Input Number from 1 to 10")

End If

End Sub

Private Sub exitButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles exitButton.Click

'Show Random and Close Application
MessageBox.Show("The number was " & random, "Answer", MessageBoxButtons.OK)
Me.Close()

End Sub

Private Sub newButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles newButton.Click

' Generate random number and direct focus to text box
Dim randomGenerator As New Random
random = randomGenerator.Next(1, 11)
inputTextBox.Focus()

End Sub


Private Sub Label1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label1.Click

End Sub
End Class
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 
AnswerRe: Showing custom controls? Pin
Dave Kreskowiak30-Dec-07 7:59
mveDave Kreskowiak30-Dec-07 7:59 
GeneralCannot open View Designer in Visual Studio Pin
Meenge27-Dec-07 20:21
Meenge27-Dec-07 20:21 
GeneralRe: Cannot open View Designer in Visual Studio Pin
Paul Conrad30-Dec-07 10:41
professionalPaul Conrad30-Dec-07 10:41 
GeneralControl For Crystal in VB.Net As VB Pin
Meenge27-Dec-07 20:15
Meenge27-Dec-07 20:15 
GeneralRe: Control For Crystal in VB.Net As VB Pin
Paul Conrad30-Dec-07 10:43
professionalPaul Conrad30-Dec-07 10:43 

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.