I was doing a project for my uncle, a multiple timer(5 timers in one program). He wants it to be able to save everything, minutes, hours, seconds, and all text boxes. I can do that. However i'm not sure how to load it back into all the variables and text boxes.
This is my code so far. The part I can't figure out is in the box
Private Sub load_Click()
End Sub
I have tried many things. I've tried to Do while through the text file, I can't seem to get anything to input. I don't really know visual basic. I only know what I have learned back in 2001, and what I can look up on the internet.
Thanks
-Jason
'Job 1 counters
Dim i1 As Integer 'second Job1
Dim k1 As Integer 'minute Job1
Dim n1 As Integer 'hour Job1
'Job 2 counters
Dim i2 As Integer 'second Job2
Dim k2 As Integer 'minute Job2
Dim n2 As Integer 'hour Job2
'Job 3 counters
Dim i3 As Integer 'second Job3
Dim k3 As Integer 'minute Job3
Dim n3 As Integer 'hour Job3
'Job 4 counters
Dim i4 As Integer 'second Job4
Dim k4 As Integer 'minute Job4
Dim n4 As Integer 'hour Job4
'Job 5 counters
Dim i5 As Integer 'second Job5
Dim k5 As Integer 'minute Job5
Dim n5 As Integer 'hour Job5
Private Sub bugs_Click()
MsgBox "Please Report any bugs you find to -------------------"
End Sub
'clears the timer and text box
Private Sub clear1_Click()
If MsgBox("Are you sure you want to clear Job 1?", vbOKCancel) = vbOK Then
sec1.Enabled = 0
LabelS.Caption = 0
LabelM.Caption = 0
LabelH.Caption = 0
i1 = 0
k1 = 0
n1 = 0
Job1 = ""
End If
End Sub
'clears the timer and text box
Private Sub clear2_Click()
If MsgBox("Are you sure you want to clear Job 2?", vbOKCancel) = vbOK Then
sec2.Enabled = 0
LabelS2.Caption = 0
LabelM2.Caption = 0
LabelH2.Caption = 0
i2 = 0
k2 = 0
n2 = 0
Job2 = ""
End If
End Sub
'clears the timer and text box
Private Sub clear3_Click()
If MsgBox("Are you sure you want to clear Job 3?", vbOKCancel) = vbOK Then
sec3.Enabled = 0
LabelS3.Caption = 0
LabelM3.Caption = 0
LabelH3.Caption = 0
i3 = 0
k3 = 0
n3 = 0
Job3 = ""
End If
End Sub
'clears the timer and text box
Private Sub clear4_Click()
If MsgBox("Are you sure you want to clear Job 4?", vbOKCancel) = vbOK Then
sec4.Enabled = 0
LabelS4.Caption = 0
LabelM4.Caption = 0
LabelH4.Caption = 0
i4 = 0
k4 = 0
n4 = 0
Job4 = ""
End If
End Sub
'clears the timer and text box
Private Sub clear5_Click()
If MsgBox("Are you sure you want to clear Job 5?", vbOKCancel) = vbOK Then
sec5.Enabled = 0
LabelS5.Caption = 0
LabelM5.Caption = 0
LabelH5.Caption = 0
i5 = 0
k5 = 0
n5 = 0
Job5 = ""
End If
End Sub
'initializes everything, sets all time to 0.
Private Sub Form_Load()
clock.Enabled = 1
'For Job 1
LabelS.Caption = 0
LabelM.Caption = 0
LabelH.Caption = 0
i1 = 0
k1 = 0
n1 = 0
'For job 2
LabelH2.Caption = 0
LabelM2.Caption = 0
LabelS2.Caption = 0
i2 = 0
k2 = 0
n2 = 0
'For job 3
LabelH3.Caption = 0
LabelM3.Caption = 0
LabelS3.Caption = 0
i3 = 0
k3 = 0
n3 = 0
'For job 4
LabelH4.Caption = 0
LabelM4.Caption = 0
LabelS4.Caption = 0
i4 = 0
k4 = 0
n4 = 0
'For job 5
LabelH5.Caption = 0
LabelM5.Caption = 0
LabelS5.Caption = 0
i5 = 0
k5 = 0
n5 = 0
End Sub
Private Sub about_Click()
MsgBox ("Version 1.2.1" & _
vbCrLf + "-------------------------------------------.")
End Sub
'quits program
Private Sub exit_Click()
End
End Sub
'starts system time
Private Sub clock_Timer()
Label1.Caption = Time
End Sub
Private Sub load_Click()
'nothing yet
End Sub
'saves all time and text boxs
Private Sub save_Click()
Open App.Path & ("\tux.txt") For Output As #1
Print #1, i1
Print #1, k1
Print #1, n1
Print #1, Job1.Text
Print #1, i2
Print #1, k2
Print #1, n2
Print #1, Job2.Text
Print #1, i3
Print #1, k3
Print #1, n3
Print #1, Job3.Text
Print #1, i4
Print #1, k4
Print #1, n4
Print #1, Job4.Text
Print #1, i5
Print #1, k5
Print #1, n5
Print #1, Job5.Text
Close #1
End Sub
'Job number 1 counter
'Job number 1 counter
'Job number 1 counter
'Job number 1 counter
'Job number 1 counter
'Job number 1 counter
'resumes timer
Private Sub Resume_Click()
sec1.Enabled = 1
End Sub
'pauses timer
Private Sub Stop_Click()
sec1.Enabled = 0
End Sub
'goes through each second and increments min and hours like a
'real clock
Private Sub sec1_Timer()
i1 = i1 + 1
LabelS.Caption = i1
If i1 = 60 Then
i1 = 0
k1 = k1 + 11
Else: End If
LabelM.Caption = k1
If k1 = 60 Then
k1 = 0
n1 = n1 + 1
Else: End If
LabelH.Caption = n1
If n1 = 24 Then
n1 = 0
Else: End If
End Sub
'Job number 2 counter
'Job number 2 counter
'Job number 2 counter
'Job number 2 counter
'Job number 2 counter
'Job number 2 counter
Private Sub Resume2_Click()
sec2.Enabled = 1
End Sub
Private Sub Stop2_Click()
sec2.Enabled = 0
End Sub
Private Sub sec2_Timer()
i2 = i2 + 1
LabelS2.Caption = i2
If i2 = 60 Then
i2 = 0
k2 = k2 + 1
Else: End If
LabelM2.Caption = k2
If k2 = 60 Then
k2 = 0
n2 = n2 + 1
Else: End If
LabelH2.Caption = n2
If n2 = 24 Then
n2 = 0
Else: End If
End Sub
'Job number 3 counter
'Job number 3 counter
'Job number 3 counter
'Job number 3 counter
'Job number 3 counter
'Job number 3 counter
Private Sub Resume3_Click()
sec3.Enabled = 1
End Sub
Private Sub Stop3_Click()
sec3.Enabled = 0
End Sub
Private Sub sec3_Timer()
i3 = i3 + 1
LabelS3.Caption = i3
If i3 = 60 Then
i3 = 0
k3 = k3 + 1
Else: End If
LabelM3.Caption = k3
If k3 = 60 Then
k3 = 0
n3 = n3 + 1
Else: End If
LabelH3.Caption = n3
If n3 = 24 Then
n3 = 0
Else: End If
End Sub
'Job number 4 counter
'Job number 4 counter
'Job number 4 counter
'Job number 4 counter
'Job number 4 counter
'Job number 4 counter
Private Sub Resume4_Click()
sec4.Enabled = 1
End Sub
Private Sub Stop4_Click()
sec4.Enabled = 0
End Sub
Private Sub sec4_Timer()
i4 = i4 + 1
LabelS4.Caption = i4
If i4 = 60 Then
i4 = 0
k4 = k4 + 1
Else: End If
LabelM4.Caption = k4
If k4 = 60 Then
k4 = 0
n4 = n4 + 1
Else: End If
LabelH4.Caption = n4
If n4 = 24 Then
n4 = 0
Else: End If
End Sub
'Job number 5 counter
'Job number 5 counter
'Job number 5 counter
'Job number 5 counter
'Job number 5 counter
'Job number 5 counter
Private Sub Resume5_Click()
sec5.Enabled = 1
End Sub
Private Sub Stop5_Click()
sec5.Enabled = 0
End Sub
Private Sub sec5_Timer()
i5 = i5 + 1
LabelS5.Caption = i5
If i5 = 60 Then
i5 = 0
k5 = k5 + 1
Else: End If
LabelM5.Caption = k5
If k5 = 60 Then
k5 = 0
n5 = n5 + 1
Else: End If
LabelH5.Caption = n5
If n5 = 24 Then
n5 = 0
Else: End If
End Sub
This post has been edited by jahgro: 17 September 2008 - 02:34 PM

New Topic/Question
Reply




MultiQuote




|