473,387 Members | 1,603 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

ignoring events when loading form

Hi,

I have a form with various controls which are wired to events when their
data, listindex, or whatever changes.

Simple question: As I'm loading the form (in the constructor), I need to set
the control's initial values without their events getting fired. It seems to
be a pretty common requirement. Any quick way of doing this? (short of using
a boolean flag!)

TIA,
Norvin
Nov 16 '05 #1
2 1307
RCS
I don't know of any way, but how I've done this in the past is have a
class-level boolean called IsLoading, then inside all your events you have

if ( ! IsLoading )
{
}

Hope that helps...
"Norvin Laudon" <12*@asd.com> wrote in message
news:eL**************@TK2MSFTNGP09.phx.gbl...
Hi,

I have a form with various controls which are wired to events when their
data, listindex, or whatever changes.

Simple question: As I'm loading the form (in the constructor), I need to
set
the control's initial values without their events getting fired. It seems
to
be a pretty common requirement. Any quick way of doing this? (short of
using
a boolean flag!)

TIA,
Norvin

Nov 16 '05 #2
Why not wire the events after the initial values are set?
I believe Visual Studio uses this technique when it generates the
"InitializeComponent" method.

- Magnus

"Norvin Laudon" <12*@asd.com> wrote in message
news:eL**************@TK2MSFTNGP09.phx.gbl...
Hi,

I have a form with various controls which are wired to events when their
data, listindex, or whatever changes.

Simple question: As I'm loading the form (in the constructor), I need to
set
the control's initial values without their events getting fired. It seems
to
be a pretty common requirement. Any quick way of doing this? (short of
using
a boolean flag!)

TIA,
Norvin

Nov 16 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

28
by: Dennis Owens | last post by:
I am trying to run a thread off of a form, and every once in a while the thread will raise an event for the form to read. When the form gets the event, the form will place the event into a dataset...
5
by: knocte | last post by:
Hello. I am a web developer very worried about "bloat code" and "languages mixture". So, since some time, I always try to avoid completely the use of javascript in XHTML/HTML files. This leads...
2
by: KarenP | last post by:
In my Windows Forms application, while executing a process that takes some time, I am changing the cursor to the hourglass by setting Cursor.Current = Cursors.WaitCursor. This is working just...
1
by: John Cosmas | last post by:
I have a login form which I will redirect to another page which will have to display a clock gif which rotates as long as the backend events are running while I load my profiles. Until then, I...
2
by: RAJ | last post by:
In our multi-tier application, we have several ASP.NET user controls which will update the same data source provided by middle tier logic. In this particular scenario we have one user control...
6
by: Steve Hershoff | last post by:
Hi everyone, I've got a strange one here. There are two datagrids on my page, one nested within the other. I'll refer to them as the topmost and secondary datagrids. In the topmost...
1
by: Dave A | last post by:
I have a problem that I have boiled down to a very simple example. I have a user control that displays a some data from a business object. On one screen I have a collection of these business...
15
by: colin | last post by:
Hi, Im familiar with c,c++ etc, and Ive spent a week trying to write my first app in c# it works reasonably well, but im having difficulty getting to grips with inter thread signalling etc. I...
2
by: HammRadio | last post by:
I am exploring converting my web app (current Framework 1.1) to Framework 2.0. Everything went smoothly save for one item. To reduce the trips to the database, when loading user controls (like a...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.