B
Bails
Hi Im an absolute beginner in programming and am using VB.Net Express.
To start my larning I decided to do a "Real World" app instead of
"hello world" and am creating a Poker Countdown clock.
I pretty much have most things under control and have set it up as
follows:
Form 1 Contains a DataGridView where users enter in information
includeing the length of each round, small blind & big blind (its for
Texas Holdem Poker).
This then feeds the round information to Form2 which essential is the
display screen and includes the count down clock.
I can get it to read and run down the clock for the first round, but
am stumped on how I can get it to reset and pick up the infor for the
2nd and subsequant rounds.
I tried putting references back to the Timer1_Tick routine, but I get
an error message that says " argument not specified for parameter 'e'
of Public Sub Timer1_Tick(sender as object, e as System.EventArgs).
I have listed the code (for form2) below and would appreciate any
feedback you can give me.
--------------------------------------------------------------------------------------------------------------------------------------------------------------------
Public Class Form2
'Dim RoundLength As Integer = Form1.RoundLength
Dim RL As Integer = Form1.Round_InformationDataGridView.Item(1,
0).Value
Dim RoundLength As Integer = RL * 600
Dim RoundNumber As Integer = Form1.RoundNumber
Dim SmallBlind As Integer =
Form1.Round_InformationDataGridView.Item(2, 0).Value
Dim BigBlind As Integer =
Form1.Round_InformationDataGridView.Item(3, 0).Value
Dim NextSmall As Integer =
Form1.Round_InformationDataGridView.Item(2, 1).Value
Dim NextBig As Integer =
Form1.Round_InformationDataGridView.Item(3, 1).Value
Private Sub Form2_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load
Timer1.Enabled = False
Button1.Text = "Start"
Button2.Text = "Pause"
Label1.Text = "0" & RL & ":00"
Label2.Text = "Round " & RoundNumber
Label3.Text = SmallBlind
Label4.Text = BigBlind
Label5.Text = "Next Small Blind " & NextSmall
Label6.Text = "Next Big Blind " & NextBig
End Sub
Private CountDownStart
Private Sub button1_Click1(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Button1.Click
If Not Timer1.Enabled Then
CountDownStart = Microsoft.VisualBasic.DateAndTime.Timer
Timer1.Enabled = True
Button1.Text = "Stop"
Button2.Text = "Pause"
Button2.Enabled = True
Else
Timer1.Enabled = False
'MsgBox("Final Time: " & Label1.Text & vbCrLf & vbCrLf &
"Click OK to reset the clock.")
Label1.Text = "0" & RL & ":00"
Button1.Text = "Start"
Button2.Text = "-----"
Button2.Enabled = False
End If
End Sub
Private Sub Button2_Click1(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Button2.Click
Static PauseInterval
If Timer1.Enabled Then
PauseInterval = Microsoft.VisualBasic.DateAndTime.Timer -
CountDownStart
Timer1.Enabled = False
Button1.Text = "Restart"
Button2.Text = "Resume"
Else
CountDownStart = Microsoft.VisualBasic.DateAndTime.Timer -
PauseInterval
Timer1.Enabled = True
Button1.Text = "Stop"
Button2.Text = "Pause"
End If
End Sub
Public Sub Timer1_Tick(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Timer1.Tick
Dim MinDiff
Dim SecDiff
Dim TenthDiff
Dim TimeDiff
'TimeDiff = (6000) -
Int((Microsoft.VisualBasic.DateAndTime.Timer - CountDownStart) * 10)
TimeDiff = (RoundLength) -
Int((Microsoft.VisualBasic.DateAndTime.Timer - CountDownStart) * 10)
If TimeDiff >= 0 Then
TenthDiff = TimeDiff Mod 10
SecDiff = Int(TimeDiff / 10) Mod 60
MinDiff = Int(TimeDiff / 600)
Label1.Text = Format(MinDiff, "00") & ":" &
Format(SecDiff, "00") '& "." & Format(TenthDiff, "0")
Else
Label1.Text = "00:00"
Timer1.Enabled = False
'MsgBox("!!!TIME!!!")
RoundNumber += 1
Button1.Text = "Start"
Button2.Text = "-----"
Button2.Enabled = False
Timer1_Tick()
End If
Application.DoEvents()
End Sub
End Class
--------------------------------------------------------------------------------------------------------------------------------------------------------------
To start my larning I decided to do a "Real World" app instead of
"hello world" and am creating a Poker Countdown clock.
I pretty much have most things under control and have set it up as
follows:
Form 1 Contains a DataGridView where users enter in information
includeing the length of each round, small blind & big blind (its for
Texas Holdem Poker).
This then feeds the round information to Form2 which essential is the
display screen and includes the count down clock.
I can get it to read and run down the clock for the first round, but
am stumped on how I can get it to reset and pick up the infor for the
2nd and subsequant rounds.
I tried putting references back to the Timer1_Tick routine, but I get
an error message that says " argument not specified for parameter 'e'
of Public Sub Timer1_Tick(sender as object, e as System.EventArgs).
I have listed the code (for form2) below and would appreciate any
feedback you can give me.
--------------------------------------------------------------------------------------------------------------------------------------------------------------------
Public Class Form2
'Dim RoundLength As Integer = Form1.RoundLength
Dim RL As Integer = Form1.Round_InformationDataGridView.Item(1,
0).Value
Dim RoundLength As Integer = RL * 600
Dim RoundNumber As Integer = Form1.RoundNumber
Dim SmallBlind As Integer =
Form1.Round_InformationDataGridView.Item(2, 0).Value
Dim BigBlind As Integer =
Form1.Round_InformationDataGridView.Item(3, 0).Value
Dim NextSmall As Integer =
Form1.Round_InformationDataGridView.Item(2, 1).Value
Dim NextBig As Integer =
Form1.Round_InformationDataGridView.Item(3, 1).Value
Private Sub Form2_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load
Timer1.Enabled = False
Button1.Text = "Start"
Button2.Text = "Pause"
Label1.Text = "0" & RL & ":00"
Label2.Text = "Round " & RoundNumber
Label3.Text = SmallBlind
Label4.Text = BigBlind
Label5.Text = "Next Small Blind " & NextSmall
Label6.Text = "Next Big Blind " & NextBig
End Sub
Private CountDownStart
Private Sub button1_Click1(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Button1.Click
If Not Timer1.Enabled Then
CountDownStart = Microsoft.VisualBasic.DateAndTime.Timer
Timer1.Enabled = True
Button1.Text = "Stop"
Button2.Text = "Pause"
Button2.Enabled = True
Else
Timer1.Enabled = False
'MsgBox("Final Time: " & Label1.Text & vbCrLf & vbCrLf &
"Click OK to reset the clock.")
Label1.Text = "0" & RL & ":00"
Button1.Text = "Start"
Button2.Text = "-----"
Button2.Enabled = False
End If
End Sub
Private Sub Button2_Click1(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Button2.Click
Static PauseInterval
If Timer1.Enabled Then
PauseInterval = Microsoft.VisualBasic.DateAndTime.Timer -
CountDownStart
Timer1.Enabled = False
Button1.Text = "Restart"
Button2.Text = "Resume"
Else
CountDownStart = Microsoft.VisualBasic.DateAndTime.Timer -
PauseInterval
Timer1.Enabled = True
Button1.Text = "Stop"
Button2.Text = "Pause"
End If
End Sub
Public Sub Timer1_Tick(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Timer1.Tick
Dim MinDiff
Dim SecDiff
Dim TenthDiff
Dim TimeDiff
'TimeDiff = (6000) -
Int((Microsoft.VisualBasic.DateAndTime.Timer - CountDownStart) * 10)
TimeDiff = (RoundLength) -
Int((Microsoft.VisualBasic.DateAndTime.Timer - CountDownStart) * 10)
If TimeDiff >= 0 Then
TenthDiff = TimeDiff Mod 10
SecDiff = Int(TimeDiff / 10) Mod 60
MinDiff = Int(TimeDiff / 600)
Label1.Text = Format(MinDiff, "00") & ":" &
Format(SecDiff, "00") '& "." & Format(TenthDiff, "0")
Else
Label1.Text = "00:00"
Timer1.Enabled = False
'MsgBox("!!!TIME!!!")
RoundNumber += 1
Button1.Text = "Start"
Button2.Text = "-----"
Button2.Enabled = False
Timer1_Tick()
End If
Application.DoEvents()
End Sub
End Class
--------------------------------------------------------------------------------------------------------------------------------------------------------------