Loop
-
I had write this code for (int i = 0; i < totalEquipment; i++) try { for (int j = 0; j < sEquip[index].index; j++) { try { ... bar[j].Size = new Size(length,20); bar[j].BackColor = System.Drawing.Color.Blue; bar[j].Location = new Point(xPosition,yPosition); this.Controls.Add(bar[j]); ... } catch (Exception ex) { throw new Exception(ex.Message + " " + ex.StackTrace); } finally { xPosition += length; } } } catch (Exception ex) { throw new Exception(ex.Message + " " + ex.StackTrace); } finally { yPosition -= range; } } } The problem is this part which it keep add panel to window form without stoping like non stop looping. How can i stop this error? try { ... bar[j].Size = new Size(length,20); bar[j].BackColor = System.Drawing.Color.Blue; bar[j].Location = new Point(xPosition,yPosition); this.Controls.Add(bar[j]); ... }
-
I had write this code for (int i = 0; i < totalEquipment; i++) try { for (int j = 0; j < sEquip[index].index; j++) { try { ... bar[j].Size = new Size(length,20); bar[j].BackColor = System.Drawing.Color.Blue; bar[j].Location = new Point(xPosition,yPosition); this.Controls.Add(bar[j]); ... } catch (Exception ex) { throw new Exception(ex.Message + " " + ex.StackTrace); } finally { xPosition += length; } } } catch (Exception ex) { throw new Exception(ex.Message + " " + ex.StackTrace); } finally { yPosition -= range; } } } The problem is this part which it keep add panel to window form without stoping like non stop looping. How can i stop this error? try { ... bar[j].Size = new Size(length,20); bar[j].BackColor = System.Drawing.Color.Blue; bar[j].Location = new Point(xPosition,yPosition); this.Controls.Add(bar[j]); ... }
-
There is nothing in that code that would create a loop. I assume that ... means that there are more code in the block, what does that code contain?
--- single minded; short sighted; long gone;
The code contain an array of panel that will be add to window form. It will be display according to the number of input. The problem is the panel will be display but it keep blinking during runtime meaning that it generate too many panel...
-
I had write this code for (int i = 0; i < totalEquipment; i++) try { for (int j = 0; j < sEquip[index].index; j++) { try { ... bar[j].Size = new Size(length,20); bar[j].BackColor = System.Drawing.Color.Blue; bar[j].Location = new Point(xPosition,yPosition); this.Controls.Add(bar[j]); ... } catch (Exception ex) { throw new Exception(ex.Message + " " + ex.StackTrace); } finally { xPosition += length; } } } catch (Exception ex) { throw new Exception(ex.Message + " " + ex.StackTrace); } finally { yPosition -= range; } } } The problem is this part which it keep add panel to window form without stoping like non stop looping. How can i stop this error? try { ... bar[j].Size = new Size(length,20); bar[j].BackColor = System.Drawing.Color.Blue; bar[j].Location = new Point(xPosition,yPosition); this.Controls.Add(bar[j]); ... }
Why all the try statements ? You need to step through the code to see what is going on.
Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )