Shamil Salakhetdinov
shamil at smsconsulting.spb.ru
Wed Sep 30 05:30:08 CDT 2009
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 __________ Information from ESET NOD32 Antivirus, version of virus signature database 4469 (20090930) __________ The message was checked by ESET NOD32 Antivirus. http://www.esetnod32.ru