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

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.
 
S

Steve

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)
 
P

pteranodon

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top