472,779 Members | 1,806 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Checkbox array question (Program stops responding)

4
I need to associate the elements of a bool type matrix with the state of a checkbox from an array that i've created. For example: if the element checkBoxMatrix[3,4] is checked then the the element in boolMatrix[3,4] is changed to true and if it is unchecked it is changed to false. However; this is not my problem.

The size of the matrices aren't fixed. I dynamically allocate the number of rows and columns.It works fine when the ranges are small, but when these ranges become kind of big, for example 100 by 100, the program stops responding.

I would like to stick with the array of checkboxes since I'm kind of new with C#, but creating a table (like in Exel, if there is a way) on the form would suffice.

Any and all ideas are welcome...
Dec 6 '07 #1
3 1545
Frinavale
9,735 Expert Mod 8TB
I need to associate the elements of a bool type matrix with the state of a checkbox from an array that i've created. For example: if the element checkBoxMatrix[3,4] is checked then the the element in boolMatrix[3,4] is changed to true and if it is unchecked it is changed to false. However; this is not my problem.

The size of the matrices aren't fixed. I dynamically allocate the number of rows and columns.It works fine when the ranges are small, but when these ranges become kind of big, for example 100 by 100, the program stops responding.

I would like to stick with the array of checkboxes since I'm kind of new with C#, but creating a table (like in Exel, if there is a way) on the form would suffice.

Any and all ideas are welcome...
Could you please post the code that you are using to dynamically allocate the memory for your arrays?

Are you sure that you are properly cleaning up the memory once you are finished with it?

(Is this a web application or desktop application?)
Dec 6 '07 #2
Jakes
4
****This is the code where I create the array:
Expand|Select|Wrap|Line Numbers
  1. this.ActCondState=new System.Windows.Forms.CheckBox[this.ruleType.GetNumOfRules(),this.ruleType.GetNumOfAct() + this.ruleType.GetNumOfCond()];
  2.  
  3. j=40;
  4.  
  5. this.checkBoxDimension1 = this.ruleType.GetNumOfRules();
  6. this.checkBoxDimension2 = this.ruleType.GetNumOfAct() + this.ruleType.GetNumOfCond();
  7.  
  8. //Creates the checkboxes which maintain the state of each entry in the decision matrix
  9. for(k=0;k<this.checkBoxDimension1;++k)
  10. {
  11.      int o=30;
  12.      for(l=0;l<this.checkBoxDimension2;++l)
  13.      {
  14.         this.ActCondState[k,l] = new System.Windows.Forms.CheckBox();
  15.         if(this.ruleType.GetDecisionMatrixElem(k,l) == true)
  16.     this.ActCondState[k,l].Checked =true;
  17.         this.ActCondState[k,l].CheckStateChanged += new EventHandler
  18.         mainFrm_CheckStateChanged);
  19.         this.ActCondState[k,l].Location = new System.Drawing.Point(j,o);
  20.         this.ActCondState[k,l].Size =new System.Drawing.Size(30,20);
  21.         this.ActCondState[k,l].Name = "ActCondState"+k+"_"+l; 
  22.         this.RuleTypePopulateTab.Controls.AddRange(new
  23.         System.Windows.Forms.Control[]  {this.ActCondState[k,l]});
  24.         o+=20;
  25.       }
  26.       j+=40;
  27. }
  28.  
  29. //****This is the code where i dispose of each individual checkbox:
  30.  
  31. if(ActCondState != null)
  32. {
  33.           for(k=0;k<this.checkBoxDimension1;++k)
  34.     for(l=0;l<this.checkBoxDimension2;++l)
  35.     {
  36.           this.ActCondState[k,l].Dispose();
  37.     }
  38. }
  39.  
Thank you for your response
Dec 7 '07 #3
Jakes
4
Oh, and its a desktop application.
Dec 7 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: claudel | last post by:
Hi I have a newb PHP/Javascript question regarding checkbox processing I'm not sure which area it falls into so I crossposted to comp.lang.php and comp.lang.javascript. I'm trying to...
7
by: Rodney King | last post by:
Hi, I have developed an ASP page which dynamically displays a list of checkbox options based on a SQL statement. Here is my code: <div style="OVERFLOW:auto; Height: 150px"> <table> <% dim...
0
by: Michael Bourgon | last post by:
I've been having the same problem for 2 weeks now. If anyone has any ideas, I'd love to hear them. We are using both SQL and Windows Authentication. I was running a Profiler Trace at the time,...
4
by: Piotr | last post by:
how can I read (in alert for example) array index number of checked checkbox? I have: <input type="checkbox" id="id_number" name="check" value="1" onclick="show()"/> <input type="checkbox"...
10
by: Nimit | last post by:
Hi, I wasn't sure which forum this post belongs to, so I've posted it to a couple forums that I thought may be appropriate. In giving me advice, please consider me a beginner. Below is a synopsis...
9
by: Craig Andrews | last post by:
Hello, How do I access HTML CheckBoxs in the codebehind section of an ASP.NET program? In the old Interdev days one would: For i = 1 to Request.Form("CheckBox").Count if...
2
by: gce | last post by:
What happens : When I first press the button, I get an listbox1 with a,b,c (correct: because of the addtoa(1, "a") addtoa(2, "b") addtoa(3, "c") When I check the checkbox, the eventhandler...
1
by: Sluggoman | last post by:
Hi all, Am floundering through a course in which C was not a pre-req, but the assignment is in C - If someone could point out where I am going way off the rails, I'd apprecciate it. Please be...
8
by: Sunny | last post by:
Hi, Can someone tell me, How to redefine array or make array empty or null. Here what I am trying to do. var temp = new Array(); for(i=0; i <=outstring.length-1; i++) { temp =...
0
by: Rina0 | last post by:
Cybersecurity engineering is a specialized field that focuses on the design, development, and implementation of systems, processes, and technologies that protect against cyber threats and...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
0
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
0
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: lllomh | last post by:
How does React native implement an English player?
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth

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.