Posted on 2004-11-22
Last Modified: 2010-04-24
I have an input of a numericupdowncontrol and two of groupsof radiobuttons:
Radio button group1(Credits)
rad1 = +0
rad2 =+3
rad3 = +5
Radio button group2(Penalties)
rad4 = +0
rad4 = -5
rad4 = automatic 0 score
And my output grade is(textbox)(button Compute)
A=> 90
B =[80..89]
C =[70..79]
D =[60..69]
F =[0..59]
I can calculate the first group of radio buttons usingt if and then button click procedure but cant add the second group of radio buttonsto the final answer.also the grade  how do you code if final grade = 80..89 then etc. thanks i  i really appreciate your help
Question by:Barako2
    LVL 6

    Expert Comment

    Can you post your code, please?
    LVL 85

    Expert Comment

    by:Mike Tomlinson
    Yes...since this is definitely a homework assignment we need to see what work you have done already.


    Author Comment

    Button click Event
    i can calculate it using atextbox as an input but dont know a numeric up down control  
    Test Score = TextBox1.Text
    Dim RoughGrade As Double
    If radio Button1 checked = True Then
    RoughGrade TextBox1.Text + 0
    If RadioButton2 checked = True Then
    RoughGrade =TextBox1Text + 3
    If RadioButton3 checked = True Then
    RoughGrade = TextBox1Text + 5
    I think this is wrong

    LVL 6

    Accepted Solution

    Is this what you are trying to do?

        Private Function CalcGrade() As String
            Dim RoughGrade As Integer

            If RadioButton1.Checked Then
                RoughGrade += 0
            End If
            If RadioButton2.Checked Then
                RoughGrade += 3
            End If
            If RadioButton3.Checked Then
                RoughGrade += 5
            End If
            If RadioButton4.Checked Then
                RoughGrade += 0
            End If

            Dim Grade As String
            Select Case RoughGrade
                Case Is >= 90
                    Grade = "A"
                Case Is >= 80
                    Grade = "B"
                Case Is >= 70
                    Grade = "C"
                Case Is >= 60
                    Grade = "D"
                Case Else
                    Grade = "F"
            End Select
            Return Grade
        End Function

    Author Comment

    yeah somewhat like that but i cant add the other group of radio buttons by the way i forgot the labels
    Extra credit
    None = 0 points
    Average = 3 points
    Above average = 5 points
    On Time= 0 penalty
    2 days late= 5 point penalty
    2+ days late= 0 grade
    LVL 6

    Expert Comment

    What do you mean you can't add the other group of radio buttons?

    Author Comment

    since each group of radio buttons is in a group box.
    Tips:Declare global variables by placingthe Dim statement outside all methods
    *gdbExtraCredit: to remember how much extra-credit should be given
    *gdbLate: remember how much late penalty should be taken off depending on wheteher its on time, 1-2 days late or more than 2 days late
    *For each radio button, code a sub that handles the checkedchanged event
       for example:
    Private sub
    gdblate = -5
    >Use a group of radiobutton controls to determine the grade on extra credit
    >Use a second group of radio buttons to determine whether a student handed in the assignment on time with the default on time . the other choices are 1-2 days late (5 point penalty)
     and more than 2 days late( automatic score of zero)
    > display the final total grade in a read-only textbox control. Use global variables to keep track of which radio button control is checked before determining the final grade.


    Author Comment

    When i debug the program i cant select aradio button in the second group
    LVL 6

    Expert Comment

    Can you show us your code?  It is hard to guess what your project looks like.  Does the second group have a different name from the first group?

    Author Comment

    i tried your code its the same thing. Yes groupbox1 and groupbox2

    Author Comment

    If you want ill e-mail you the user interface so you can see how it works

    Author Comment

    Thanks i Finally figured it out

    Author Comment

    There was extra code thats why the second group of buttonscant be accessed. Thank you very much platinumBay . Ill accept your answer.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
    The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (…
    Internet Business Fax to Email Made Easy - With eFax Corporate (, you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    728 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now