|
-
Jul 4th, 2000, 02:07 PM
#1
Thread Starter
Hyperactive Member
i don't really undertstand the basics about functions ... i tried making one for my program but i don't get the value i want ...
average = ((((mp1 + mp2 + mp3 + mp4) * 2) + (midt + final)) / 10)
Call test
lblyraverage.Caption = average & " " & "[" & letter & "]"
the letter value never comes up ... i just have the average
---by the way the line with "average" is one whole line ... n the variables r dimmed ... i just didn't copy those things to this thread
my function looks like this:
Public Function test()
Dim letter As String
Select Case average
Case Is >= 97
letter = "A+"
Case Is >= 93
letter = "A"
Case Is >= 90
letter = "A-"
Case Is >= 87
letter = "B+"
Case Is >= 83
letter = "B"
Case Is >= 80
letter = "B-"
Case Is >= 77
letter = "C+"
Case Is >= 73
letter = "C"
Case Is >= 70
letter = "C-"
Case Is >= 65
letter = "D"
Case Is >= 60
letter = "F"
Case Is >= 0
letter = "F-"
End Select
End Function
how come i don't get the letter value?
-
Jul 4th, 2000, 02:17 PM
#2
Lively Member
Have you tried an ELSE statement with other resulting letter in you SELECT?
Roger
-
Jul 4th, 2000, 02:38 PM
#3
Frenzied Member
Nearly there, You just missed out one line just before End Function you need to putthis tells the function to return the value in letter.
If it wasn't for this sentence I wouldn't have a signature at all.
-
Jul 4th, 2000, 03:05 PM
#4
Thread Starter
Hyperactive Member
nope
no that didn't work ... i wonder y it won't give out the letter value ...
-
Jul 4th, 2000, 03:28 PM
#5
You wrote Select Case average Where did this "Avergae" come from? In order to use it in your Function, you must pass it through.
Code:
Public Function test(average)
'Enter the rest of your code here...
test = letter 'Return the letter
End Function
To call it, pass average through it. This should print out an -A
Code:
MyAverage = 92
RetVal = text (MyAverage)
Print RetVal
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
|