Link to home
Start Free TrialLog in
Avatar of Mr_Shaw
Mr_Shaw

asked on

C# Handles

In vb it is possible to use handles to extend the use of a function/event.

I tried doing the same thing in c# and it did not work.

Here is my code.

protected void UpdateTextBoxes_Textchanged(object sender, EventArgs e)Handle Textbox1.TextChanged, TextBox2.TextChanged
    {

    }

But it does not work... Can anybody help?
SOLUTION
Avatar of Craig Wagner
Craig Wagner
Flag of United States of America 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
ASKER CERTIFIED SOLUTION
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
SOLUTION
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 Mr_Shaw
Mr_Shaw

ASKER

Here is my code... It does not do anything.
I have put breakpoints in and it never gets to the event.

    protected void btnNext_Click(object sender, EventArgs e)
    {
        updateDB();
    }
    protected void updateDB()
    {
        TextBox Comments = (TextBox)FormView1.FindControl("Textbox_Comments");
        Comments.TextChanged += UpdateTextBoxes_Textchanged;
    }
    protected void UpdateTextBoxes_Textchanged(object sender, EventArgs e)
    {
        Response.Write("Empty");
    }
SOLUTION
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 Mr_Shaw

ASKER

ItemCreated?
Avatar of Mr_Shaw

ASKER

I used the event ItemCreated but It returned

Object reference not set to an instance of an object.
Avatar of Mr_Shaw

ASKER

thanks