![]() |
|
|
|
Thread Tools | Display Modes |
|
|
|
|
#1 |
|
Newbie
Join Date: Oct 2006
Location: Philippines
Posts: 13
Rep Power: 0
![]() |
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 SubThis would mean a lot to me, if u look and help me.... Thank you all... By: Jaynie |
|
|
|
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Bizarre TI-89 matrix algebra error (not language specific) | Generic | Other Scripting Languages | 0 | Sep 7th, 2005 8:16 PM |
| Prog hangs when entering new loop... | layer | C++ | 1 | May 6th, 2005 6:59 AM |
| ASCII conversion loop difficulty | crmpicco | Visual Basic | 2 | May 3rd, 2005 1:55 PM |
| WinSock accept() hangs program in Do loop... | layer | C++ | 5 | Apr 29th, 2005 11:28 AM |
| Type Mismatch Error = 13 | Benjizzle | Visual Basic | 5 | Mar 15th, 2005 5:23 PM |