Jump to content
Xtreme .Net Talk

Recommended Posts

Posted
I have a sub that is run on every textbox on the screen and it's executed when there is a change in the text or in other words using the on textchanged event but they are all fire when the mdi form is loading so does anybody know if there is a onfinish loading event or something like that?
Posted

If it is a problem put a bool value under InitializeComponent() setting it to true. (The bool variable must be global).

 

Also, in your text changed events use the same bool value and only execute the code if it is true.

C#
  • *Experts*
Posted

We try a similar trick, but not using the extra variable:

if(this.ActiveControl!=(Control)sender) return;

 

Seems to work until the form is shown. Normally, you don't care about an event unless that control has the focus. This may not be true if you rely on events to either cascade or if you want to set a property and have the event fire for you. The TextChanged is a bad example, but suppose you were using the ComboBox's IndexChanged - it fires whenever you set the SelectedIndex property through code.

 

I only mention the above because some people *hate* these types of form level flags. Me, I use them if they're needed (I call mine bInitializing :))

 

-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...