Author | Message | Time |
---|---|---|
Anubis | It's been a long day and I can't seem to remember... How can I call something like the Visible property inside a usercontrol from a module or form? My usercontrol is named HC. Thanks | June 12, 2004, 12:53 AM |
Eli_1 | [quote author=Anubis link=board=31;threadid=7208;start=0#msg64735 date=1087001600] It's been a long day and I can't seem to remember... How can I call something like the Visible property inside a usercontrol from a module or form? My usercontrol is named HC. Thanks [/quote] Do you mean something like this? [code] Form1.HC.Visible = False[/code] | June 12, 2004, 12:57 AM |
Anubis | [quote author=Eli_1 link=board=31;threadid=7208;start=0#msg64736 date=1087001836] [code] Form1.HC.Visible = False[/code] [/quote] Oh, I mean when I'm creating an ocx from the usercontrol. So it won't be on the form/module in the usercontrol's project. I've found that HC.Visible = True doesn't seem to do anything. I've also tried usercontrol.Visible, same with usercontrol1.Visible... | June 12, 2004, 1:00 AM |
Eli_1 | Oops. ::) Is this what you're looking for? Taken from: http://support.microsoft.com/?kbid=183691 [quote] Workaround To workaround this problem, you can have the UserControl pass a reference to itself on the Form by a procedure. The following steps illustrate this solution. 1.) Create an ActiveX Control project. 2.) Click Add Form on the Project menu to add a form to the project. 3.) Add the following code to the UserControl: Public CtlProp As String 'user created property Private Sub UserControl_Click() CtlProp = "passed value" 'set the property Load Form1 Call Form1.ControlRef(Me) 'pass the reference before showing Form1.Show End Sub Private Sub UserControl_Initialize() BackColor = vbRed End Sub Add the following code to the Form: Dim cCtl As UserControl1 Private Sub Form_Activate() MsgBox cCtl.CtlProp 'this works fine now End Sub Sub ControlRef(cC As UserControl1) Set cCtl = cC End Sub [/quote] | June 12, 2004, 1:08 AM |
Anubis | [quote author=Eli_1 link=board=31;threadid=7208;start=0#msg64738 date=1087002483] Oops. ::) Is this what you're looking for? http://support.microsoft.com/?kbid=183691 [/quote] Ah, yes. Exactly what I'm looking for. Thanks :) | June 12, 2004, 1:10 AM |
Anubis | Well, just a quick question. One of my main reasons for needing this is so I can use RaiseEvent from a form/module. Is there any way I can do this from a form/module instead of a usercontrol? | June 12, 2004, 5:39 AM |