Results 1 to 5 of 5

Thread: Help ~~~~*

  1. #1

    Thread Starter
    Dazed Member
    Join Date
    Oct 1999
    Location
    Ridgefield Park, NJ
    Posts
    3,418

    Post

    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

  2. #2
    Junior Member
    Join Date
    Nov 1999
    Location
    Thailand
    Posts
    20

    Post

    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


  3. #3

    Thread Starter
    Dazed Member
    Join Date
    Oct 1999
    Location
    Ridgefield Park, NJ
    Posts
    3,418

    Post

    ahhhhhh yes. What was i thinking.
    thanx.

  4. #4
    Junior Member
    Join Date
    Nov 1999
    Location
    Sydney, NSW, Australia
    Posts
    16

    Post

    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

  5. #5
    New Member
    Join Date
    Jul 1999
    Location
    San Francisco, CA, USA
    Posts
    4

    Post

    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
  •  



Click Here to Expand Forum to Full Width