Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I have code in a textboxes textchanged event which obviously fires when the user changes the text in the textbox.

 

Question is if I change the textboxes text from code elsewhere during runtime, why doesn't the textchanged event fire?

 

Is there a way to force it to fire?

My website
Posted

Mmm correct me if I'm wrong but is it ok to call a textbox textchanged event manually?

 

If so I have just sorted it:):)

My website
  • *Experts*
Posted

You can manually call any event handler as they're just functions that happen to get called by the event handler (through a delegate). The "special" work is done by the event, not the function that gets called.

 

Many people would rather move the code out from the TextChanged event into a function, say UpdateFirstName (if the textbox is txtFirstName for instance). Then call UpdateFirstName() from the event handler (TextChanged event) and from wherever else you're changing the textbox's value manually.

 

-Nerseus

"I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...