Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
UserControl
Message
General information
Forum:
ASP.NET
Category:
Other
Title:
Miscellaneous
Thread ID:
00714741
Message ID:
00715213
Views:
16
To call a method on your form that hosts the UserControl, you use the FindForm method of the UserControl. You need to cast the Form to the specific class of the form that is hosting the control. In the control inside the UserControl you reference a method on the form like:
CType(Me.FindForm(), MyForm).MyButton.PerformClick()
>Hi Cathi,
>
>Fist, I would like to thank you for your excellent help, you always give me your assistant.
>
>Cathi, What I need is the oposit way ... the user control "uc_Buttos" have 5 buttons in the form, when the user clicks on btnAdd for example I should berform the add procedure .. that I need to know how to do this, because when I click in the button the event in the user control event is excuted .. so how to link it to the form I am using now??
>
>What I am trying now, I found a way which is:
>In the user control click_event I track which form is active, get the form name by doing this command :
>"strFormName = Windows.Forms.Form.ActiveForm.ActiveMdiChild.Name"
>then inhiret a new form from the called form:
>"Dim j As New Windows.Forms.Form(strFormName)"
>then excute the add procedure in the origenal form:
>j.AddRecord()
>
>this way is working if I am passing the original form name, but when I pass the variable it's not working.
>
>Maybe my way is wrong ... and maybe it's correct but need a litle modifications.
>
>Please advice
>
>Many thanks to you
>
>ADSC
>
>>To call the click event from a button inside a user control, you would do the following:
>>
>>
>>Me.UserControl11.Button1.PerformClick()
>>
>>
>>>Hi all,
>>>
>>>I am trying to move my standard buttons like “Add, Save, Delete, Exit” to a “User Control”, then I add this user control to my application forms.
>>>
>>>The problem, I don’t know how to control the click event for each button on the form because in the form I see the user control as one part.
>>>
>>>Can anyone help me in doing this.
>>>
>>>Appreciate any assistance
>>>
>>>ADSC
-----------------------------------------

Cathi Gero, CPA
Prenia Software & Consulting Services
Microsoft C# / .NET MVP
Mere Mortals for .NET MVP
cgero@prenia.com
www.prenia.com
Weblog: blogs.prenia.com/cathi
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform