If (e.KeyChar < "1" Or e.KeyChar > "9") AndAlso e.KeyChar <> ControlChars.Back AndAlso e.KeyChar <> "." Then
e.Handled = True
Thursday, January 12, 2012
Wednesday, January 5, 2011
Tuesday, December 21, 2010
Chapter 17- Sub Procedures
Page 263-264 - Do the problem from the reading (weekly pay solution)
Page 367369 - Do problem from reading (Birthday Solution)
Pick 2 out of the 3... or do them all
Page 381-382- Problem 4- Grade Solution- then #5 Modify Grade Solution
Problem #7- Water Bill
Problem #8- Cable Company
Page 367369 - Do problem from reading (Birthday Solution)
Pick 2 out of the 3... or do them all
Page 381-382- Problem 4- Grade Solution- then #5 Modify Grade Solution
Problem #7- Water Bill
Problem #8- Cable Company
Friday, December 17, 2010
Yahtzee Stuff
'Rolls 3 times and disables button
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btndiceRoll.Click
countRolls = countRolls + 1
Timer1.Enabled = True
If countRolls = 3 Then
btndiceRoll.Enabled = False
End If
End Sub
'Dice change 10 times and holding dice
If Hold1.Checked = False Then
r1 = Int(Rnd() * 6) + 1
End If
' rnd picks a number between 0 and .999999
If r1 = 1 Then
Dice1.Load("c:\Programming2010\Dice\d1.gif")
End If
If r1 = 2 Then
Dice1.Load("c:\Programming2010\Dice\d2.gif")
End If
If r1 = 3 Then
Dice1.Load("c:\Programming2010\Dice\d3.gif")
End If
If r1 = 4 Then
Dice1.Load("c:\Programming2010\Dice\d4.gif")
End If
If r1 = 5 Then
Dice1.Load("c:\Programming2010\Dice\d5.gif")
End If
If r1 = 6 Then
Dice1.Load("c:\Programming2010\Dice\d6.gif")
End If
'rolls Dice 10 times before stopping
If countTimes = 10 Then
Timer1.Enabled = False
countTimes = 0
End If
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btndiceRoll.Click
countRolls = countRolls + 1
Timer1.Enabled = True
If countRolls = 3 Then
btndiceRoll.Enabled = False
End If
End Sub
'Dice change 10 times and holding dice
If Hold1.Checked = False Then
r1 = Int(Rnd() * 6) + 1
End If
' rnd picks a number between 0 and .999999
If r1 = 1 Then
Dice1.Load("c:\Programming2010\Dice\d1.gif")
End If
If r1 = 2 Then
Dice1.Load("c:\Programming2010\Dice\d2.gif")
End If
If r1 = 3 Then
Dice1.Load("c:\Programming2010\Dice\d3.gif")
End If
If r1 = 4 Then
Dice1.Load("c:\Programming2010\Dice\d4.gif")
End If
If r1 = 5 Then
Dice1.Load("c:\Programming2010\Dice\d5.gif")
End If
If r1 = 6 Then
Dice1.Load("c:\Programming2010\Dice\d6.gif")
End If
'rolls Dice 10 times before stopping
If countTimes = 10 Then
Timer1.Enabled = False
countTimes = 0
End If
Tuesday, December 14, 2010
Using INPUT to create a STORY
Dim strName As String
Dim strColor As String
Dim intAge As Integer
Dim strHairColor As String
Dim x As Integer
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnStart.Click
x = x + 1
If x = 1 Then
strName = InputBox("What is your name")
strColor = InputBox("What is your favorite color")
intAge = InputBox("What is your Age")
strHairColor = InputBox("What is the color of you hair")
End If
If x = 2 Then
lblTitle.Text = "The Story of " & strName
End If
btnStart.Text = "Continue"
If x = 3 Then
lblTitle.Text = "There was a person named " & strName & ControlChars.NewLine & " who had only $" & intAge.ToString
End If
Dim strColor As String
Dim intAge As Integer
Dim strHairColor As String
Dim x As Integer
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnStart.Click
x = x + 1
If x = 1 Then
strName = InputBox("What is your name")
strColor = InputBox("What is your favorite color")
intAge = InputBox("What is your Age")
strHairColor = InputBox("What is the color of you hair")
End If
If x = 2 Then
lblTitle.Text = "The Story of " & strName
End If
btnStart.Text = "Continue"
If x = 3 Then
lblTitle.Text = "There was a person named " & strName & ControlChars.NewLine & " who had only $" & intAge.ToString
End If
Monday, December 13, 2010
Keypress- only press keys from 1 to 9
Private Sub txtNumber_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtNumber.KeyPress
If (e.KeyChar < "1" Or e.KeyChar > "9") AndAlso e.KeyChar <> ControlChars.Back Then
e.Handled = True
End If
End Sub
If (e.KeyChar < "1" Or e.KeyChar > "9") AndAlso e.KeyChar <> ControlChars.Back Then
e.Handled = True
End If
End Sub
Subscribe to:
Posts (Atom)
