# GPA Average Problem.. Loops and Counters? HELP!

Page 1 of 1

## 4 Replies - 579 Views - Last Post: 09 March 2012 - 09:29 AMRate Topic: //<![CDATA[ rating = new ipb.rating( 'topic_rate_', { url: 'http://www.dreamincode.net/forums/index.php?app=forums&module=ajax&section=topics&do=rateTopic&t=270091&amp;s=f1c431fdf218e65e38b3293c7a1dce1e&md5check=' + ipb.vars['secure_hash'], cur_rating: 0, rated: 0, allow_rate: 0, multi_rate: 1, show_rate_text: true } ); //]]>

### #1 tivoli

Reputation: 0
• Posts: 20
• Joined: 09-March 12

# GPA Average Problem.. Loops and Counters? HELP!

Posted 09 March 2012 - 12:29 AM

Hi. I am having trouble programming a solution that will allow the user to select their gender from a listbox along with their GPA and then having such labels as "All Students" "Male Students" and "Female Students" display the average for all of the user inputs. This assignment deals with loops, counters, and accumulators. I am currently stuck and I need someone to please help! I would appreciate it so much!

This is what I have so far

```Public Class Form1

Private Sub ListBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles genderListBox.SelectedIndexChanged

End Sub

Private Sub gpaListBox_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles gpaListBox.SelectedIndexChanged

End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Me.Close()
End Sub

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

Dim gender As String
gender = CStr(genderListBox.Text)

End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

allLabel.Text = Convert.ToString(gpaListBox.SelectedItem)
If genderListBox.SelectedItem = "M" Then
maleLabel = maleLabel + allLabel
End If
If genderListBox.SelectedItem = "F" Then femaleLabel.Text = Convert.ToString(gpaListBox.SelectedItem)

Dim projectCounter As Integer = +1
Dim totalAccumulator As Integer

Do While projectCounter > 50
projectCounter += 1

Loop

Dim all As Decimal
all = CDec(allLabel.Visible = True)

Dim male As Decimal
male = CDec(maleLabel.Visible = True)

Dim female As Decimal
female = CDec(femaleLabel.Visible = True)

End Sub

Private Sub all_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles allLabel.Click

End Sub
End Class
```

Is This A Good Question/Topic? 0

## Replies To: GPA Average Problem.. Loops and Counters? HELP!

### #2 nK0de

• Catch me As Exception

Reputation: 204
• Posts: 823
• Joined: 21-December 11

## Re: GPA Average Problem.. Loops and Counters? HELP!

Posted 09 March 2012 - 12:38 AM

what exactly is your problem?? where are you stuck?

btw You're missing the End If at line 37. And you don't really have to specify +1 when declaring numbers(line 39). They are positive by default.

And explain what you're trying to do here. line 52 - 59

This post has been edited by nK0de: 09 March 2012 - 12:43 AM

### #3 tivoli

Reputation: 0
• Posts: 20
• Joined: 09-March 12

## Re: GPA Average Problem.. Loops and Counters? HELP!

Posted 09 March 2012 - 01:04 AM

The program is supposed to allow the users to choose their GPA from a list of values in a list box and also to allow them to choose whether they are Male or Female from a list box. From these two selections each user makes, there are three labels (Male Average, Female Average, and All Students Average) that will display the average GPA for each type of student.

### #4 nK0de

• Catch me As Exception

Reputation: 204
• Posts: 823
• Joined: 21-December 11

## Re: GPA Average Problem.. Loops and Counters? HELP!

Posted 09 March 2012 - 01:37 AM

That's not the answer to what I asked. That's the question given to you.
Tell me what's the exact problem your having with your code? what are the errors if getting any.

This post has been edited by nK0de: 09 March 2012 - 01:38 AM

### #5 tivoli

Reputation: 0
• Posts: 20
• Joined: 09-March 12

## Re: GPA Average Problem.. Loops and Counters? HELP!

Posted 09 March 2012 - 09:29 AM

I have everything coded correctly except finding a way to code the labels that show the averages of all the inputs of "male", "female", and "all students".