Hello! I need some help with my code. Here's the background information:

Six students take three tests. I need to find the grade average of each student (test 1, 2, and 3), then I need to find the average grade of test 1, test 2, and test 3. Next, I have to find the average of the student's average. Finally, I need to put the information in FileInfo Class form.

Sorry, if I confused you, however, this is the code I have so far. Don't worry about the FileInfo if it's too much or if you're not sure what I'm talking about, I believe I have a packet that explains the process to me.

Here's the code I created. When it gets to finding the average of the avverages, it doesn't work.

``````Dim quiz1_a = CInt(quiz1a.Text)
Dim quiz2_a = CInt(quiz2a.Text)
Dim quiz3_a = CInt(quiz3a.Text)

stuav1.Text = CInt(CInt(quiz1_a(1, 1) + quiz2_a(1, 2) + quiz3_a(1, 3) / 3))

Dim quiz1_b = CInt(quiz1b.Text)
Dim quiz2_b = CInt(quiz2b.Text)
Dim quiz3_b = CInt(quiz3b.Text)

stuav2.Text = CInt(CInt(quiz1_b(2, 1) + quiz2_b(2, 2) + quiz3_b(2, 3)) / 3)

Dim quiz1_c = CInt(quiz1c.Text)
Dim quiz2_c = CInt(quiz2c.Text)
Dim quiz3_c = CInt(quiz3c.Text)

stuav3.Text = CInt(CInt(quiz1_c(3, 1) + quiz2_c(3, 2) + quiz3_c(3, 3)) / 3)

Dim quiz1_d = CInt(quiz1d.Text)
Dim quiz2_d = CInt(quiz2d.Text)
Dim Quiz3_d = CInt(quiz3d.Text)

stuav4.Text = CInt(CInt(quiz1_d(4, 1) + quiz2_d(4, 2) + Quiz3_d(4, 3)) / 3)

Dim quiz1_e = CInt(quiz1e.Text)
Dim quiz2_e = CInt(quiz2e.Text)
Dim Quiz3_e = CInt(quiz3e.Text)

stuav5.Text = CInt(CInt(quiz1_e(5, 1) + quiz2_e(5, 2) + Quiz3_e(5, 3)) / 3)

Dim quiz1_f = CInt(quiz1f.Text)
Dim quiz2_f = CInt(quiz2f.Text)
Dim Quiz3_f = CInt(quiz3f.Text)

stuav6.Text = CInt(CInt(quiz1_f(6, 1) + quiz2_f(5, 2) + Quiz3_f(5, 3)) / 3)

quiz1av.Text = CInt(CInt(quiz1_a(1, 1) + quiz1_b + quiz1_c + quiz1_d + quiz1_e + quiz1_f) / 6)
quiz2av.Text = CInt(CInt(quiz2_a + quiz2_b + quiz2_c + quiz2_d + quiz2_e + quiz2_f) / 6)
quiz3av.Text = CInt(CInt(quiz3_a + quiz3_b + quiz3_c + Quiz3_d + Quiz3_e + Quiz3_f) / 6)``````

Sorry if I seem idiotic, it's just that I'm a novice to VB.

Thanks!:cheesy:

2
Contributors
1
2
Views
11 Years
Discussion Span
Last Post by QVeen72

Hi,

Replace CInt() with Val().
What are these? and where are u initiating/Pulling data from?
quiz1_f(6, 1) ...quiz1_a(1, 1) ..quiz2_a(1, 2) ?
If they are not stored with proper data, u may not get proper results.

Change the average finding code this way,

stuav1.text = Format(((Val(quiz1_c(1, 1)) + Val(quiz2_c(1, 2)) + Val(quiz3_c(1, 3))) / 3), "0.00")

If u still have problems, get back to me.

Regards
Veena

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.