I would like to create an object (a rectangle) on the fly in VB.

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

iI would like to read in a datafile that tells me how many boxes to draw. I
would then like to be able to create that number of rectangles n VB code to
be displayed on a form.
 
How about using labels or textboxes. You can do a lot more with them. Look
at the CreateControl method in the Help file.

PC Datasheet
Providing Customers A Resource For Help With Access, Excel And Word
Applications
(e-mail address removed)
 
One approach, other than CreateControl, is pre-creating the maximum
number of
rectangles that you'll need on the form during design time. You can
set their Visible property to False at first and then use a sub called
by the form's Current Event to figure out which to change to visible,
move them, size them, etc.

It will seem to the user that they are being created, but really they
are being shown / hidden and formatted. This has a lot less
overhead and doesn't require the user to make design changes, etc.

HTH,

Kevin
 
Back
Top