Wrox Home  
Search P2P Archive for: Go

  Return to Index  

pro_vb thread: Label loop nightmare


Message #1 by al.higgs@b... on Wed, 18 Sep 2002 17:45:53
Al,

probably you have a resume next in your code that prevents you
to see the error.
The strategy is this:

  Do while i < 30000
   if i < label.count then
      load label(i)
   endif
   ... yuor code here
  Loop

BTW: This code will NOT work because the maximum number of controls
you can put in a form is 255. I never tried with control arrays, but
I doubt it.

Marco

> Hi,

> Ive got a form on which i have created a label called label(0).  Im 
trying 
t> o create a loop that will write the label out on the form as many times 
a> s indicated by the loop.  However what my code currenlty does is look 
for 
t> he label called label(1), label(2) etc. etc.  Obviously these dont 
a> ctually exist, i want the loop to dynamically create them.  I'll put 
the 
c> ode below and if anyone has a quick and simple fix please let me know.

>         labelTop = 1200
 >        labelText = "Hello"
 >        i = 0
 >        
 >        Do While labelTop < 3000
 >        .label(i).Top = labelTop
 >        .label(i).Caption = "Hello this is label number " & i
 >        i = i + 1
 >        labelTop = labelTop + 200
 >        Loop

> Any ideas anyone???

> Regards

> Al

  Return to Index