• 0

[VB.NET] User Controls


Question

Hi All,

I'm a little bit new to user controls and have basically made a user control that incorporates a picturebox, a textbox and a few other controls. Basically what I want to do is allow the form to execute code whenever the textbox.textchanged event is trigged on the textbox.

I notice when I type UserControl.TextChanged or anything to that effect it is of no help.

Can anyone give me a hand here, user controls are all new to me.

Regardz :)

Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 0

Your user control is not exposing that event.

At the top of the user control class declaration add:

Public Event TextChanged as EventHandler

And then in the Textbox (from your usercontrol) TextChanged event, add this line:

RaiseEvent TextChanged(e, sender)

It should work then.

Link to comment
Share on other sites

  • 0
Your user control is not exposing that event.

At the top of the user control class declaration add:

Public Event TextChanged as EventHandler

And then in the Textbox (from your usercontrol) TextChanged event, add this line:

RaiseEvent TextChanged(e, sender)

It should work then.

Genious! Thanks a lot. Did the trick perfectly.

Regardz :)

Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.