Re: Logic Error
- From: "C# newbie with big problems" <roman_666@xxxxxxxxxxx>
- Date: 7 Jul 2006 12:08:53 -0700
Tom Spink wrote:
C# newbie with big problems wrote:
Ok, I am building a product configurator which works quite well except
for a few bugs. It has a couple of listboxes and a checked list box.
Now the checked list box holds upgrades for products listed in a
different listbox and these upgrades are grouped by category so for
example if you select a computer then the checked list box may display:
512 RAM
1GB RAM
HDD 30 GB
HDD 60 GB
video...
so, these products are in logical groupings... RAM, HDD, etc. When I
select the checkbox for 1GB RAM then I want to get rid of the checkbox
on 512 RAM and here is where I run into my problem. I decided to give
each member of a group an identifier. Then I created an
ItemCheckChanged event handler. When one of the checks changes I change
all the other checks associated with this group which in turn changes
all the other cheks associated with this group which in turn changes...
you get the idea. This recursive loop never ends and I cant seem to get
the logic working any other way. Any Suggestions on how to fix my
problem? I dont care if there is another type of listbox that may help
or some way to stop logging the remainder of the check changes or even
comming up with some sort of dynamic radio button group thing (because
different items may have different amounts of upgrades and radio
buttons are what I really need here anyway)
thanx
--Roman
Hi Roman,
You could use a flag to indicate that the check is changing:
///
private bool _checkChanging;
private void OnCheckChanged ( object sender, EventArgs e )
{
if ( _checkChanging )
return;
_checkChanging = true;
try
{
// Do Your Processing
}
finally
{
_checkChanging = false;
}
}
///
--
Hope this helps,
Tom Spink
Im not sure that would do me either tom... It seems to me that as soon
as the check changes it will launch the check changed event which will
launch the check changed event and so on... Im starting to think I need
a different way to approach this issue, unless there is a way to stop
logging that the check changes for the second time
.
- Follow-Ups:
- Re: Logic Error
- From: Tom Spink
- Re: Logic Error
- References:
- Logic Error
- From: C# newbie with big problems
- Re: Logic Error
- From: Tom Spink
- Logic Error
- Prev by Date: Re: Logic Error
- Next by Date: Re: New to C#
- Previous by thread: Re: Logic Error
- Next by thread: Re: Logic Error
- Index(es):
Relevant Pages
|