Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

Panel inside a panel

$
0
0
I am trying to automate panel creation for a software i am developing. Its essentially, creating a panel pragmatically with two labels, a picture box, and 6 text boxes. But when it comes to run time. There isn't any errors. Just no visible results.

This is my code:
private void ReGenerateColumns(DataTable RecordSet)
        {
            // lets list out the columns one by one.
            // we are going to display all the photos in the system in order. This way we dont have to do any reconstruction everytime we need to update the panes.
            System.IO.Directory.CreateDirectory(Application.StartupPath + @"\tempimages\");
            EndingLocation = RecordSet.Rows.Count;
            lbl_Status.Text = "Loading . . .";
            for (int i = startingLocation; i < EndingLocation; i++)
            {
                lbl_Status.Text = "Processing " + i.ToString() + " of " + EndingLocation;
                Application.DoEvents();
                Panel newPanel = new Panel();
                newPanel.Width = ColumnWidth;
                newPanel.Height = this.Height - 65;
                newPanel.BackColor = Color.Red;
                newPanel.BorderStyle = BorderStyle.FixedSingle;
                newPanel.Location = new Point(lastolLoc, 10);
                newPanel.Dock = DockStyle.Left;
                newPanel.Visible = true;
                newPanel.Click += new EventHandler(newPanel_Click);
                if (lastolLoc == 0)
                {
                    NewColumnHeader(newPanel, RecordSet.Rows[i].ItemArray[0].ToString().PadLeft(4, '0'), RecordSet.Rows[i].ItemArray[58].ToString().Remove(0, RecordSet.Rows[i].ItemArray[58].ToString().LastIndexOf(@"\") + 1), 1);
                    SetColumnPicture(newPanel, RecordSet.Rows[i].ItemArray[58].ToString(), 270);
                    SetColumnTextBoxes(newPanel, RecordSet.Rows[i].ItemArray[8].ToString(), RecordSet.Rows[i].ItemArray[9].ToString(), RecordSet.Rows[i].ItemArray[10].ToString(), RecordSet.Rows[i].ItemArray[11].ToString(), RecordSet.Rows[i].ItemArray[22].ToString(), RecordSet.Rows[i].ItemArray[33].ToString(), RecordSet.Rows[i].ItemArray[39].ToString());
                    lastolLoc = ColumnWidth + columnPading;
                }
                else
                {
                    SetColumnTextBoxes(newPanel, RecordSet.Rows[i].ItemArray[8].ToString(), RecordSet.Rows[i].ItemArray[9].ToString(), RecordSet.Rows[i].ItemArray[10].ToString(), RecordSet.Rows[i].ItemArray[11].ToString(), RecordSet.Rows[i].ItemArray[22].ToString(), RecordSet.Rows[i].ItemArray[33].ToString(), RecordSet.Rows[i].ItemArray[39].ToString());
                    SetColumnPicture(newPanel, RecordSet.Rows[i].ItemArray[58].ToString(), 270);
                    NewColumnHeader(newPanel, RecordSet.Rows[i].ItemArray[0].ToString().PadLeft(4, '0'), RecordSet.Rows[i].ItemArray[58].ToString().Remove(0, RecordSet.Rows[i].ItemArray[58].ToString().LastIndexOf(@"\") + 1), 1);
                    lastolLoc = lastolLoc + Convert.ToInt32((ColumnWidth + columnPading));
                }
                    this.pnl_pictureList.Controls.Add(newPanel); // Adds the panel to the main panel on the form.
            }
            lbl_Status.Text = "";
        }


Im not sure how this is getting so messed up...

Any incite ?

Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>