Click here to Skip to main content
15,919,778 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
//how to pass multiple column width dynamic created numerice updown control using mshtml


C#
for (int i = 0; i < txtno; i++)
               {

                   Label b = new Label();
                   b.Text = ("Col" + (i + 1)).ToString();
                   b.Location = new Point(pointX, pointY);
                   b.Width = 34;
                   // b.Width = 35;
                   b.Height = 20;
                   columnwid.flowLayoutPanel1.Controls.Add(b);
                   columnwid.flowLayoutPanel1.Show();
                   pointX += 36;
              // }
                       //TextBox a = new TextBox();
                       //HtmlElement row2 = table.GetElementsByTagName("tr")[0];
                       //foreach (HtmlElement cell2 in row2.GetElementsByTagName("td"))
                       //{
                       NumericUpDown a = new NumericUpDown();

                       //a.Value=(Math.Round(System.Convert.ToDecimal(elementCell.style.width)));
                       a.Location = new Point(pointX, pointY);
                       columnwid.flowLayoutPanel1.Controls.Add(a);
                       columnwid.flowLayoutPanel1.Show();
                       a.Width = 45;
                       //a.Width = 35;
                       a.Height = 20;
                       pointX += 36;
                       columnwid.radioWidthPixel.Checked = true;

                       //int width = Convert.ToInt32(cellSelect.style.width);
                       object width = cellSelect.style.width;
                          // string width = cell2.GetAttribute("width").ToString();
                       //if (width == null)
                       //{
                       //    width = cellSelect.width;
                       //    // width = Convert.ToInt32(cellSelect.width);
                       //}


                       if (width != null)
                       {

                           value = decimal.Parse(width.ToString().Replace("%", string.Empty).Replace("px", string.Empty).Replace("pt", string.Empty));
                           if (value > 0)
                           {
                               a.Value = value;
                               j = a.Value;

                               // columnwid.radioWidthPixel.Checked = true;
                           }
                       }
Posted

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