Link to home
Start Free TrialLog in
Avatar of anitaj
anitaj

asked on

Interaction between form and usercontrol


While working with usercontrol containing richtextbox i need to create a form containing tabbed control which inturn contains a textbox and button. When the button in the form is clicked the text entered in the textbox is searched throughout the richtextbox. the text is obtained from the textbox using modules and then is accessed by the usercontrol.
i want that the button clicks and the rest of the events to be captured as well.If at all it can be done tell me how to do it.
I will be thankful to you.
Thankyou.
ASKER CERTIFIED SOLUTION
Avatar of EDDYKT
EDDYKT
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of DennisBorg
DennisBorg

Anitaj:

In your UserControl, you can create a Public method which your form would use to invoke the search:


Public Sub SearchText(ByVal strSearchText As String)
   ' *** insert code here to perform the search
End Sub


Suppose you then added your custom control to your form and named it "UC1". Suppose the name of the button on your form is named "cmdSearch", and the name of the textbox (containing search text) on your form is named "txtSearch". Then the code in the command button's click event would look something like:

   Private Sub cmdSearch_Click()
      UC1.SearchText txtSearch.Text
   End Sub


-Dennis Borg
Avatar of anitaj

ASKER

Thanks EDDYKT

Your code do help me a lot. My problem was solved today.
Thanks a lot.

Anita.
Avatar of anitaj

ASKER

hi eddykt its working fine. i am using thos control in an
html form .when i close the browser window it is giving
unexpected error and some memory error.functionally its working good. do u know any thing about this error.
 
anita