Click here to Skip to main content
15,920,005 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
This is my code
      private void DragAndDropArea_Load(object sender, EventArgs e)
      {
          #region Areoload
          //load the areo into the form
          this.BackColor = Color.Black;
          MARGINS m = new MARGINS();
          m.cxLeftWidth = -1;
          m.cxRightWidth = -1;
          m.cyBottomHeight = -1;
          m.cyTopHeight = -1;
          //set all value -1 to apply glass effect to the all of visible window
          DwmExtendFrameIntoClientArea(this.Handle, m);
          //end load areo code
          #endregion
          PictureBox newpic = new PictureBox();
          newpic.Size = new Size(80, 70);
          newpic.BackColor = Color.Red;

          if (this.Name == "Dock1")
          {

              int addpicnumber = 0;
              while (addpicnumber >= Properties.Settings.Default.Dock1.Count)
              {
                  addpicnumber += 1;
                  newpic.Name = "newpic" + addpicnumber.ToString();
                  TextReader tr = new StreamReader(Properties.Settings.Default.Dock1.ToString());
                  int NumberOfLines = Properties.Settings.Default.Dock1.Count;
                  //Make our array for each line
                  string[] ListLines = new string[NumberOfLines];
                  newpic.Tag = ListLines[1] = tr.ReadLine();
                  newpic.Location = new Point(0, newpic.Location.Y + 90);
this.Controls.Add(newpic);
              }

           //problem not adding a new picturebox

          }
          }



for some rason the picureboxes don't add when i put it in the while statment and when i put the location in the while statment the location dosen't move can soe one please help me make it so that it will add the picturebox? its meant to have like 2 in there
Posted

1 solution

your while clause expects the count to be negative - is this the case?

Two suggestions

1. Make it a for loop
2. Learn to use the debugger
 
Share this answer
 
Comments
[no name] 14-Aug-12 5:11am    
try again
barneyman 14-Aug-12 6:55am    
LOL - i think you've misunderstood our relationship; you have a problem - which i really have no investment in - i've made an observation (still valid), which would appear to be the cause of your issue ...

I wish you well - you obviously don't need me

Andreas Gieriet 15-Aug-12 9:28am    
My 5.
Cheers
Andi

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900