[dba-VB] c# text box changed event

Gustav Brock Gustav at cactus.dk
Wed Sep 30 06:43:21 CDT 2009


Hi Shamil

Thanks. That requires less code for each control which is a good thing.
However, it doesn't address the issue I had when browsing records in formview with bound textboxes. Perhaps both methods should be combined?

I think we miss an event: 

  UserChangedText 

/gustav


>>> shamil at smsconsulting.spb.ru 30-09-2009 12:30:08 >>>
Hi Gustav,

My method isn't clever - it's just dummy straightforward and simple, but I
never needed something more complicated within the .NET applications I have
developed. For example, if I wanted to block TextChanged event to be fired
during form Load event when I'm setting in code a TextBox .Text property
value from saved options file then in the beginning of the Form_Load method
I have: 

private bool _loadInProgress;

... Form_Load(...)
{
try {
  _loadInProgress = true 
...

and I in the end of Form_Load method I have:

...
finally {
  loadInProgress = false
}

 - try/catch/finally will always guarantee my flag will not be left in "On"
state. And in TextBox's TextChanged or CheckBox's CheckedChanged (and
similar) events, which fired both when corresponding controls' properties
set via UI and code I have:

..._TextChanged(...)
if (_loadInProgress) return;
...

That's it.

--Shamil 

-----Original Message-----
From: dba-vb-bounces at databaseadvisors.com 
[mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Gustav Brock
Sent: Wednesday, September 30, 2009 11:31 AM
To: dba-vb at databaseadvisors.com 
Subject: Re: [dba-VB] c# text box changed event

Hi Shamil

OK, sorry, "intermediate" is of course not "beginner" ... and I believe you
are right about that you can always learn something new when explained a
second time in another way than the first time, indeed if that was several
years ago.

As for the subject, couldn't you elaborate a bit on "I'd use context custom
flag variables"? I really feel my method is rather a work-around, but at the
time I just didn't have the time to work out a more clever method.

/gustav


>>> shamil at smsconsulting.spb.ru 29-09-2009 21:47:33 >>>
Hi Gustav,

The course I'm taking is called "Intermediate C#". :) 
I just didn't find "advanced" or "guru" course - and therefore I have taken
the most complicated one.
Yes, it's easy but I must admit I've learned some new stuff after the first
four lessons - mainly by developing simple on first glance assignments. So
it's not waste of time or money.
And I like the way they introduce C# to beginners/intermediate level
developers.
I'm learning how they do that.
Maybe one day I will go tutoring/coaching C#.
And certificate they give - it can bring some new projects to me.
And if that course will prove it's worth USD99 I spent on it I will take
some other courses from them in the new areas to me.

BTW, for the subject task I'd use context custom flag variables.

Thank you.

--
Shamil






More information about the dba-VB mailing list