PDA

Click to See Complete Forum and Search --> : Help ~~~~*


Dillinger4
Nov 18th, 1999, 02:05 AM
Im making a simple program with four text boxes on a form with four corresponding labels. Each label is a class i am taking.At the bottom is a command button. All i want is for the user to put his final grade in each of the text boxes and click the button to get their GPA.

If Text1.Text = 90 Then
int1TotalPoints = 45
ElseIf Text1.Text = 91 Then
int1TotalPoints = 45 ' 90 to 100 = 45 points
' 80 to 89 = 33.75

Is there anyway i can give 90 To 100 a value of 45 without this long coding?
Plus each TextBox can have anywhere from a Below 60 which is failing to 100 so how would i code this?
Thanxxxxxxx

pavinda
Nov 18th, 1999, 02:25 AM
I 'm not sure i understand exactly what do you mean.But if it's like i think .Try this
if text1.text >=80 and text1.text <90 then
int1TotalPoints = 33.75
elseif text1.text>=90 and text1.text<=100 then
int1TotalPoints = 45
endif

Dillinger4
Nov 18th, 1999, 03:14 AM
ahhhhhh yes. What was i thinking.
thanx.

AlanTodd
Nov 18th, 1999, 07:01 AM
Or... I prefer the CASE command as I find it easier to read and gives you more scope with multiple options. This this:-

Select Case Val(Text1.Text)
Case 90 To 100
int1totalpoints = 45
Case 80 To 90
int1totalpoints = 33.75
Case Else
int1totalpoints = 0
End Select

good Luck

CYX1020
Nov 18th, 1999, 08:52 AM
why not just do something like this
GPA = (Val(text1) + Val(text2) + Val(text3) + Val(text4)) / 4