Question:
Array problems with VIsual Basic form?
mit_mccow
2011-03-23 10:55:28 UTC
I'm trying to populate the different labels with items I have on a sheet using an array. Here is the code.

For i = 1 To 6

Label(i).Caption = (i) & ". " & Sheets("Procedures").Cells(i + 1, 2)

Next i

Everything works fine except I wont recognize the lable unless I name it "Label1" without the variable. How do I get the Lable name to work with my i variable so I can cycle my labels with my array.
Three answers:
?
2016-10-27 08:37:26 UTC
Sub substantial() Const LWB As Integer = 10 Const UPB As Integer = 100 Dim numArray(0 To UPB) As Boolean ' factors 0..9 are literally not used For i As Integer = LWB To UPB ' init numArray(i) = fake next ' ' study 20 numbers from a line, one by utilising one, into J. If numArray(J) is fake, ' set the ingredient to real and print the quantity. ' end Sub be conscious: to be more suitable sensible and keep array factors, map 10..100 to 0..ninety by utilising subtracting ten from each and every ingredient. also guard adverse to addressing non-modern storage by utilising ensuring that each and every quantity is between 10..100. ultimately, you are able to %. ninety bits into 3 32-bit unsigned ints and use bit manipulation (the array is then slightly vector).
2011-03-23 11:34:59 UTC
The ability to create control arrays through the GUI is no longer part of VB.



You can loop through the controls on a form using the form.controlcollection or you can create an array of control in code and add those controls to your form.
npgilbertson
2011-03-23 11:01:41 UTC
You could try renaming the label, otherwise i don't know what to do.


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...