PDA

Click to See Complete Forum and Search --> : Create an ActiveX at RunTime


gpalmia
Feb 22nd, 2001, 05:05 PM
I wont to insert a MSFlexGrid in a Form of Access2000 File at RunTime.
Well, Here is the sequence of operation that I made (Whithout success...sig).
1) To made a reference with MSFlexGrid Library;
2) To write This script:
Dim obj as object
set obj = CrateContol _(Myform,acCustomControl, etc.....)
Now I do not know how to go on;
How and were do I refer the class of MSFlexGrid to the control?

Scuse my language but it is the first time that I write to this forum,
usually I speak and write in my original language (Italian).
Thankyou if you have an answar for my problem.
Bye

Paul Warren
Mar 1st, 2001, 07:38 AM
Sorry, but you can't do that with a control. The CreateObject function is for creating objects provided by other applications, such as Word, Excel, etc. If you want to dynamically create controls you will need to create one on your form and make it invisible. Set it's Index to 0 so it's part of a control array and then everytime you want to create a new one just do 'Load Control(n)'.
Once it's loaded you can change properties before displaying it.

If anyone else knows of a cleaner way of doing it then please share it with us but that's the only way I've found.

Ah Beng
Mar 3rd, 2001, 08:05 AM
Hi, there's actually a way for dynamic control addition.
The idea is to use a database to store the license key of the control and the info can be retrieved during run time.

I have no time to expain it in length.
But you could find the sample from the CD. They're named CtlCfg.vbp and CtlView.vbp.

If you've installed the help file, then you can find it's description in:
Visual Basic Documentation -> Samples -> CtlsAdd Sample.

Sorry for not being more helpful.
Hope someone else will post a detail working.