Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Generate Panel

Generate Panel

Scheduled Pinned Locked Moved C#
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    shamsteady
    wrote on last edited by
    #1

    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]); ... }

    D 1 Reply Last reply
    0
    • S shamsteady

      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]); ... }

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      shamsteady wrote:

      for (int i = 0; i < totalEquipment; i++) try { for (int j = 0; j < sEquip[index].index; j++)

      This may be seem stupid but what's the value of totalEquipment multiplied by sEquip[index].index?

      Dave Kreskowiak Microsoft MVP - Visual Basic

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups