|
-
Sep 24th, 2002, 04:56 PM
#1
Thread Starter
Member
Array in Form Load Event doesn't work!
I have made a form and put 5 Combo Boxes in there.
In the Form Load event, I populated all those Combo Boxes with figures etc..
After that, I stated some arrays and then when I try to run it, it doesnt work. Message comes up saying "Expected Array".
Here is the code:
Private Sub Form_Load()
'Populate the Runway Combo Box
cboRwy.AddItem "Runway 10"
cboRwy.AddItem "Runway 28"
cboRwy.ListIndex = 0
'Populate the Flap Combo Box
cboFlap.AddItem "Flap 5"
cboFlap.AddItem "Flap 15"
cboFlap.ListIndex = 0
'Populate the Wind Combo Box
For W = -10 To 20
cboWind.AddItem (TW) & " Knots"
Next W
cboWind.ListIndex = 10
'Populate the Temperature Combo Box
For T = -10 To 40
cboTemp.AddItem (T)
Next T
cboTemp.ListIndex = 22
'Populate the QNH Combo Box
For Q = 980 To 1050
cboQnh.AddItem (Q)
Next Q
cboQnh.ListIndex = 30
'Populate the EAI Combo Box
cboEAI.AddItem "Anti Ice ON"
cboEAI.AddItem "Anti Ice OFF"
cboEAI.ListIndex = 0
A = -10
For f = 1 To 5
R10F5Array(0, f) = A
Debug.Print R10F5Array(0, f)
A = A + 5
Next
B = -10
For f = 1 To 11
R10F5Array(f, 0) = B
Debug.Print R10F5Array(f, 0)
B = B + 5
Next
'Populate the internal grid array
'for Rwy 10, Flap 5
R10F5Array(1, 1) = 18460
R10F5Array(1, 2) = 19200
R10F5Array(1, 3) = 19850
R10F5Array(1, 4) = 20320
R10F5Array(1, 5) = 20690
R10F5Array(2, 1) = 18350
R10F5Array(2, 2) = 19110
R10F5Array(2, 3) = 19750
R10F5Array(2, 4) = 20240
R10F5Array(2, 5) = 20630
R10F5Array(3, 1) = 18240
R10F5Array(3, 1) = 19020
R10F5Array(3, 1) = 19670
R10F5Array(3, 1) = 20150
R10F5Array(3, 1) = 20570
R10F5Array(4, 1) = 18120
R10F5Array(4, 1) = 18910
R10F5Array(4, 1) = 19570
R10F5Array(4, 1) = 20050
R10F5Array(4, 1) = 20490
etc..
End Sub
Do you know what the problem is?
-
Sep 24th, 2002, 04:58 PM
#2
Did you Dim the array? Given the code, that's the only thing I can see.....
-
Sep 24th, 2002, 05:08 PM
#3
Thread Starter
Member
Private Sub Form_Load()
Dim R10F5Array As Integer
Dim R10F15Array As Integer
Dim R28F5Array As Integer
Dim R28F15Array As Integer
'Populate the Runway Combo Box
cboRwy.AddItem "Runway 10"
cboRwy.AddItem "Runway 28"
cboRwy.ListIndex = 0
I've dimmed it but still says Expected Array
it highlights the first instance of using the array:
A = -10
For f = 1 To 5
R10F5Array(0, f) = A
Debug.Print R10F5Array(0, f) ' here
A = A + 5
Next
-
Sep 24th, 2002, 05:10 PM
#4
Need-a-life Member
Originally posted by Jetheat
Private Sub Form_Load()
Dim R10F5Array As Integer
Dim R10F15Array As Integer
Dim R28F5Array As Integer
Dim R28F15Array As Integer
'Populate the Runway Combo Box
cboRwy.AddItem "Runway 10"
cboRwy.AddItem "Runway 28"
cboRwy.ListIndex = 0
I've dimmed it but still says Expected Array
it highlights the first instance of using the array:
A = -10
For f = 1 To 5
R10F5Array(0, f) = A
Debug.Print R10F5Array(0, f) ' here
A = A + 5
Next
That's not an array. It should be something like this
VB Code:
Dim R10F5Array(4, 5) As Integer 'For example... check each bound
Emiliano F. Martín
If a post has helped you then please Rate it! (and give the user points he/she deserves by clicking on the image).
Encourage the person who helped you to keep doing it, and give him the points he deserves.
MP3 Organizer: Freeware to logically organize all your MP3s.
-
Sep 24th, 2002, 05:18 PM
#5
Thread Starter
Member
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|