|
-
December 17th, 1999, 09:17 AM
#1
referencing control at run time
I am creating controls at run time without setting the reference in the COMPONENTS Dialog box.
PROBLEM:
1) i am using VBControlExtender Object and creating ActiveX control(eg:FlexGrid Control).I am not setting the reference during the design time.this program allows me to create the flex grid but when i try to access the properties that are paterning to the grid it gives me the Error:"Object does not support this Property or Method". it allows only the intrensic method and property of VBControlExtender (eg:top,left,Visible etc...)
But if i set the reference at thedesign time it allows me to access all the methods and the properties.
I want to know what happens when you set the reference at the design time?
Which API functionc Are internally called? is it possible to for me to call these API functions at runtime and make my Control work?
2) how do i get the handle of windowless control?i mean which API function should i use?
Please help me as soon as possible or my job is in danger.
Pavan
-
December 17th, 1999, 10:12 AM
#2
Re: referencing control at run time
Use the following code to create a control at runtime:
' Create a new control
Set MyControl = Me.Controls.Add("ProgID", "Control Name")
This code basically adds a control to the forms control collection so the form can pass messages to that control.
-
December 17th, 1999, 10:32 AM
#3
Re: referencing control at run time
dear friend;
thank you for the reply but this way i wont be able to create ActiveX control thats the reason i have used VBControlExtender Object which allows me to create ActiveX control at run time.Any way my problem is not creating control at rnutime but referencing it at run time
Thanks
-
December 17th, 1999, 04:16 PM
#4
Re: referencing control at run time
u have to use 2 options
1- if u want to create and handle Intrinsic controls( controls on toolbox )then do as
declare in declaration section above all
dim withevents ctlNew as CommandButton
set ctlNew = Controls.Add("vb.CommandButton", "command1")
then u can use ctlNew simply as u put it from toolbox
2- If u want to create ActiveX Controls like Flex grid then
declare as
dim withevents ctlNew as vbControlExtender
set ctlNew = Controls.Add("libraryname.controlname", "FlexGrid12")
use ctlNew as lexGrid Control Object
-
December 18th, 1999, 09:54 AM
#5
Re: referencing control at run time
dear friend
Thanks for the reply.
please read my question carefully i have already used VBControlExtender object.
But with withevnets keywork i cannot create a array of Control.
in my apllication i dont know number of activeX control to be created.so this doesn't solve my problem.
even if you create with your Method and if i dont set the reference in COMPONANTS i cannot acsess the properties and methods of the control.
please try this and if you find a solution please send me.
MY JOB IS STILL IN TROUBLE.
Pavan
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|