|
-
Nov 18th, 1999, 03:05 AM
#1
Thread Starter
Dazed Member
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
-
Nov 18th, 1999, 03:25 AM
#2
Junior Member
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
-
Nov 18th, 1999, 04:14 AM
#3
Thread Starter
Dazed Member
ahhhhhh yes. What was i thinking.
thanx.
-
Nov 18th, 1999, 08:01 AM
#4
Junior Member
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
-
Nov 18th, 1999, 09:52 AM
#5
New Member
why not just do something like this
GPA = (Val(text1) + Val(text2) + Val(text3) + Val(text4)) / 4
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|