View Single Post
Old Dec 17th, 2006, 9:38 AM   #1
dsbabyGurl
Newbie
 
dsbabyGurl's Avatar
 
Join Date: Oct 2006
Location: Philippines
Posts: 13
Rep Power: 0 dsbabyGurl is on a distinguished road
Do..while loop and ....error!

Hello all, my post is about visual basic 6.0. Im tryin to add 10 scores using the DO ... while loop and adding them as an array element, after adding, it simply displays the sum of all quiz scores. I dont know if the syntax is correct and when i increment the counters, and the counters for the index of the array, an error occurs, it says,

"Compile Error
Expected: Expression"

I know this is simple, and just learning on this, i just want to know why it wont let me increment. Please help me on this.
Here is the code below:
Dim q1 As Integer
Dim q2 As Integer
Dim q3 As Integer
Dim q4 As Integer
Dim q5 As Integer
Dim q6 As Integer
Dim q7 As Integer
Dim q8 As Integer
Dim q9 As Integer
Dim q10 As Integer
Dim total As Integer
Dim i As Integer
Dim cnt As Integer


Private Sub cmdadd_Click()
Dim quiz() As String
    q1 = Val(txt1.Text)
    q2 = Val(txt2.Text)
    q3 = Val(txt3.Text)
    q4 = Val(txt4.Text)
    q5 = Val(txt5.Text)
    q6 = Val(txt6.Text)
    q7 = Val(txt7.Text)
    q8 = Val(txt8.Text)
    q9 = Val(txt9.Text)
    q10 = Val(txt10.Text)
    
    quiz(0) = q1
    quiz(1) = q2
    quiz(2) = q3
    quiz(3) = q4
    quiz(4) = q5
    quiz(5) = q6
    quiz(6) = q7
    quiz(7) = q8
    quiz(8) = q9
    quiz(9) = q10
    
    total = Val(txt11.Text)
    cnt = 1
    i = 0
    Do
        Do
            total = total + quiz(i)
            i++
        While i <= 10
        cnt++
    While cnt <= 10
            
End Sub
        
txt11.Text = total
End Sub



This would mean a lot to me, if u look and help me.... Thank you all...



By:
Jaynie
dsbabyGurl is offline   Reply With Quote