|
-
Apr 5th, 2002, 01:38 PM
#1
Thread Starter
Fanatic Member
Modify Container form using ActiveX Control
Suppose I have an activex control on a form, I want to write code in some event of the control which will get and modify the properties of the container form. (Left, Right, Height, Width, etc)
Any solutions ?
THE TIME/WEATHER IS 
Don't know how to use APIs or have problem with them,
Download API-Guide & API-Viewer from http://www.allapi.net
-
Apr 5th, 2002, 02:18 PM
#2
Hyperactive Member
I'm not sure I fully understand what you mean... but this should work if I understand correctly. When you use the "Me" object in VB it refers to the form that is using it.
VB Code:
Sub Command1_Click
Me.Caption = "The button has been clicked"
'Effect is WhateverYourFormNameIs.Caption = "..."
End Sub
Is that what you wanted?
-
Apr 5th, 2002, 02:37 PM
#3
PowerPoster
You use the Parent property
VB Code:
Private Sub UserControl_Click()
Parent.Width = 300
End Sub
-We have enough youth. How about a fountain of "Smart"?
-If you can read this, thank a teacher....and since it's in English, thank a soldier.

-
Apr 5th, 2002, 02:58 PM
#4
Hyperactive Member
Yes, Arc is also right... but that code would be inside the code of your own UserControl. If you were using an intrinsic VB control then my code would be in your form.
Now, Arc... I have a question. How can I trap a parent form's event? i.e. something like Sub Parent_Click() though that itself doesn't work.
-
Apr 5th, 2002, 03:27 PM
#5
-
Apr 5th, 2002, 03:48 PM
#6
Hyperactive Member
OK thanks, I'll either try subclassing or forget about it (I don't actually HAVE to do it)
-
Apr 6th, 2002, 01:19 AM
#7
Thread Starter
Fanatic Member
got it
THE TIME/WEATHER IS 
Don't know how to use APIs or have problem with them,
Download API-Guide & API-Viewer from http://www.allapi.net
-
Apr 6th, 2002, 08:26 PM
#8
Hyperactive Member
Just a little "survey..." by saying "Thanks Arc I got it" do you mean that you needed to use the Parent object and not the Me object?
-
Apr 7th, 2002, 01:30 AM
#9
Thread Starter
Fanatic Member
parent
I knew about the Me object. I required the Parent object to modify the form through an activex control. If you still didn't understand, download the two attachments from...
http://www.vbforums.com/showthread.php?postid=911932
I have used the Parent object, atleast more than 25 times.
Last edited by 007shahid; Apr 7th, 2002 at 01:34 AM.
THE TIME/WEATHER IS 
Don't know how to use APIs or have problem with them,
Download API-Guide & API-Viewer from http://www.allapi.net
-
Apr 7th, 2002, 04:20 AM
#10
Frenzied Member
What about using..UserControl.Extender.Parent????
-
Apr 7th, 2002, 07:15 AM
#11
Thread Starter
Fanatic Member
UserControl.Extender gives you the properties assigned by the form to your control.
Suppose if you give the statement...
Code:
MsgBox UserControl.Extender.Name
Then if the name is UserControl1 then MsgBox will say UserControl1.
Extender can be used to assign properties. Suppose you want the control to be always aligned to the bottom (like status bar control), give...
Code:
UserControl.Extender.Align = vbAlignBottom
THE TIME/WEATHER IS 
Don't know how to use APIs or have problem with them,
Download API-Guide & API-Viewer from http://www.allapi.net
-
Apr 7th, 2002, 09:58 AM
#12
Hyperactive Member
Thanks 007Shahid, I know how to use all these objects and I just wanted to know which one YOU wanted. So you wanted to modify a container from a UserControl, not modify a container form on an intrinsic control's event.
-
Apr 7th, 2002, 10:01 AM
#13
Hyperactive Member
by the way 007Shahid: my favorite way to post Visual Basic code is to use the [ VBCODE ] and [ /VBCODE] vB tags.
VB Code:
'This will be green
Sub MySub (argument As argumentType)
Me.Caption = "This is all syntax-highlighted."
End Sub
-
Apr 8th, 2002, 07:26 AM
#14
Thread Starter
Fanatic Member
VB Code:
'I hope this comes in green
Last edited by 007shahid; Apr 8th, 2002 at 07:32 AM.
THE TIME/WEATHER IS 
Don't know how to use APIs or have problem with them,
Download API-Guide & API-Viewer from http://www.allapi.net
-
Apr 8th, 2002, 12:06 PM
#15
Hyperactive Member
Congratulations you did it!
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
|