G
Guest
ok i have gotten this damn project almost done but i am frustrated on
this one step. getting 18-35 together and 36-50 and so on. here is my
code how can i get them combined in one line instead of writing it out a
million times. please help me. i have to write a program that you type in
the age and it stores it in a text file then i have to catagorize them and
when i hit the read button it shows how many times 18-35 was typed in, then
how many times 36-50 was typed in and so on.
If strRecord.Remove(0, 2) = 18 Then
strEighteen = strEighteen + 1
ElseIf strRecord.Remove(0, 2) = 36 Then
strThirtySix = strThirtySix + 1
End If
Loop
it works if i put individual numbers in and continue it down but that is
alot of code and i am sure there is an easier way
oh also how can i get the program not to input the under 18 here is my
code am i missing something?
If Me.txtAge.Text <=18 Then
MessageBox.Show("Your age must be 18 or older thank
you", "POA", _
MessageBoxButtons.OK, MessageBoxIcon.Information, _
MessageBoxDefaultButton.Button1, _
MessageBoxOptions.DefaultDesktopOnly)
End If
when i type in 17 for the age it still puts it in the text file. i need it
to not store in the text file if it is less than 18.
ok well that is my queestions please help me thanks very much
Tommy
Advanced Visual Basic .NET Programming Class
this one step. getting 18-35 together and 36-50 and so on. here is my
code how can i get them combined in one line instead of writing it out a
million times. please help me. i have to write a program that you type in
the age and it stores it in a text file then i have to catagorize them and
when i hit the read button it shows how many times 18-35 was typed in, then
how many times 36-50 was typed in and so on.
If strRecord.Remove(0, 2) = 18 Then
strEighteen = strEighteen + 1
ElseIf strRecord.Remove(0, 2) = 36 Then
strThirtySix = strThirtySix + 1
End If
Loop
it works if i put individual numbers in and continue it down but that is
alot of code and i am sure there is an easier way
oh also how can i get the program not to input the under 18 here is my
code am i missing something?
If Me.txtAge.Text <=18 Then
MessageBox.Show("Your age must be 18 or older thank
you", "POA", _
MessageBoxButtons.OK, MessageBoxIcon.Information, _
MessageBoxDefaultButton.Button1, _
MessageBoxOptions.DefaultDesktopOnly)
End If
when i type in 17 for the age it still puts it in the text file. i need it
to not store in the text file if it is less than 18.
ok well that is my queestions please help me thanks very much
Tommy
Advanced Visual Basic .NET Programming Class