|
-
Jan 12th, 2004, 10:36 AM
#1
Thread Starter
Addicted Member
Is it possible to reference a control as a property?
Hi
I've created a an activex control that control has properties for selecting the images it to use.
What I would like to do is to have a property for selecting an ImageList from the parent form instead.
Could someone explain how to add a property that will pass a reference to an image list control?
Thanks.
-
Jan 12th, 2004, 06:09 PM
#2
I wasn't clear on your needs.
1) You have an ImageList on your user control and you want to give direct access to it to a form?
2) You have an ImageList on your Form and you want to pass it to your User Control.
I assumed # 2 and assumed that this is an ActiveX Control project and not a user control in a Standard Exe project (it makes a difference). You must pass controls and forms As Object to Dll's, OCX's etc..
In your user control try the following code..
VB Code:
'user control code
Private mctlImageList As MSComctlLib.ImageList
Public Property Set ImageList(ImageListControl As Object)
If TypeOf ImageListControl Is MSComctlLib.ImageList Then
Set mctlImageList = ImageListControl
Else
Err.Raise -1, , "Expecting an ImageList control, not a " & TypeName(ImageListControl)
End If
End Property
'Form module
Private Sub Command1_Click()
Set Me.UserControl11.ImageList = Me.imgPictures
End Sub
-
Jan 13th, 2004, 04:39 AM
#3
Thread Starter
Addicted Member
Thanks great. Thanks. 
Is there a way to expose the ImageList property at design time in the property inspecter?
-
Jan 13th, 2004, 03:13 PM
#4
I think (but don't know for sure ) that this is a limitation of the User Control. You cannot have objects listed in the properties windows.
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
|