473,383 Members | 1,859 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,383 software developers and data experts.

Logic Error

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

Jul 7 '06 #1
6 1912
Hi,

You do not use checkboxes for this kind of situation but RadioButtons.
--
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
Jul 7 '06 #2
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
Jul 7 '06 #3
Right that would be great except I dont need just one group of radio
buttons, I need a dynamic amount of radio buttons, with multiple
groupings of dynamic size, which will change as soon as a new product
is selected, all in one ListBox looking object. I would happily switch
over to this if anything of the type was available. The only
checkedListBox thingy I could find is the CheckedListBox which doesn't
come in the radio button flavor... unless of course there is a class
library download that I am missing. I am not familiar enough with C# to
know what else is available that might solve my problem but would
appreciate any help

--Roman

Jul 7 '06 #4

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

Jul 7 '06 #5
C# newbie with big problems wrote:
>
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
Have you tried it? Perhaps I didn't explain the code clearly. If you
change the check inside the 'try...finally' block then it doesn't matter if
the event is fired... because the condition at the top of the method will
be satisfied, and the method will stop executing. If it stops executing at
that point, then it will no longer attempt to change the check, and so not
call the 'CheckChanged' event.

The model I've implemented above is designed to stop a method from executing
if it's already executing.

Try it, if you don't believe me!

--
Hope this helps,
Tom Spink
Jul 7 '06 #6
sorry tom... took me a while to get back to this. Yes that worked
great.. thanx alot

--Roman

Jul 25 '06 #7

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

Similar topics

4
by: nc | last post by:
My iterator can find my collection when my Action class calls my jsp directly, however when my Action class calls an html file that is set up with IFrames (one of which is loading that same jsp), I...
2
by: Thiko | last post by:
I have a sql server automatic job set up containing 2 steps. First step is an Operating System Command (CmdExec) type job which runs a .bat file which copies across a backup file to this machine....
0
by: Stephen | last post by:
I have some code which I call from a custom validator however I seem to have got the logic wrong and im having trouble figuring out how to write my code to get things to work the way I require....
0
by: Tony Johansson | last post by:
Hello Experts! I reading a book called programming with design pattern revealed by Tomasz Muldner and here I read something that sound strange. "Exception are divided into logic errors and...
1
by: Irritable Bowel Syndrome | last post by:
Just finished off a production .NET web application written in c#. I set up a error handler in the global.asax which is triggered to iterate through the error stack and send it and other...
7
by: Stephen | last post by:
I have some code which I call from a custom validator however I seem to have got the logic wrong and im having trouble figuring out how to write my code to get things to work the way I require....
8
by: - | last post by:
Hi to All, To reproduce: The expression: object result = flag ? (long) 0 : (double) 0; always evaluated as a double... see dissassembly to ensure the bad compiled code.
1
by: Vaibhav Modak | last post by:
Hi All, I have a Web Service written in Java (Web Logic) and I am trying to call it in my ASP. NET client. I am facing a problem while getting the data from the Web Service Method. My Web...
4
by: Mike | last post by:
I have an n-tier system as follows: Business Data Access Web Services
7
by: ashjas | last post by:
Hello, I have run this logic on turboc++ 3.0 and it is working fine on it but its not running on msvs2008 c++. i am not able to assign the value like this *temp=*main,where main and temp are char...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.