Do While Loop
#1
Old School Crew
Thread Starter
Join Date: May 2000
Posts: 5,251
Likes: 0
Received 0 Likes
on
0 Posts
Do While Loop
Do While sr.Peek <> -1
StoreNum = sr.ReadLine
EmpID = sr.ReadLine
EmpName = sr.ReadLine
PayType = sr.ReadLine 'reads in records from text file and puts them into memory locations
PayRate = sr.ReadLine
PayCat = sr.ReadLine
Hours = sr.ReadLine
'This portion of the code figures out if the worker is fulltime or parttime
If PayCat = "F" Then
PayCatOut = "Full Time"
ElseIf PayCat = "P" Then
PayCatOut = "Part Time"
Else
PayCatOut = "Error In Code"
End If
If PayRate = 1 Then
PayRateOut = 5.5
ElseIf PayRate = 2 Then
PayRateOut = 9.99
ElseIf PayRate = 3 Then
PayRateOut = 15.25
End If
'This portion of the code converts the hour code into a usable number of hours worked
If Hours = 1 Then
HoursOut = 20
ElseIf Hours = 2 Then
HoursOut = 25
ElseIf Hours = 3 Then
HoursOut = 30
ElseIf Hours = 4 Then
HoursOut = 40
Else : HoursOut = "Error In Code"
End If
Loop
sr.Close()
End Sub
thats it all... I'm in the middle of spitting some code out, and I got bored.
StoreNum = sr.ReadLine
EmpID = sr.ReadLine
EmpName = sr.ReadLine
PayType = sr.ReadLine 'reads in records from text file and puts them into memory locations
PayRate = sr.ReadLine
PayCat = sr.ReadLine
Hours = sr.ReadLine
'This portion of the code figures out if the worker is fulltime or parttime
If PayCat = "F" Then
PayCatOut = "Full Time"
ElseIf PayCat = "P" Then
PayCatOut = "Part Time"
Else
PayCatOut = "Error In Code"
End If
If PayRate = 1 Then
PayRateOut = 5.5
ElseIf PayRate = 2 Then
PayRateOut = 9.99
ElseIf PayRate = 3 Then
PayRateOut = 15.25
End If
'This portion of the code converts the hour code into a usable number of hours worked
If Hours = 1 Then
HoursOut = 20
ElseIf Hours = 2 Then
HoursOut = 25
ElseIf Hours = 3 Then
HoursOut = 30
ElseIf Hours = 4 Then
HoursOut = 40
Else : HoursOut = "Error In Code"
End If
Loop
sr.Close()
End Sub
thats it all... I'm in the middle of spitting some code out, and I got bored.