|
| |||||||||
| Tags: c programming, control, loop, programming |
![]() |
| | Thread Tools | Search this Thread |
|
#1
| ||||
| ||||
| Creating Controls In A Loop
Hello, I am learning c# programming and now I am working on this and now I want to create one program which will create controls in the loop. If anyone is having idea regarding it, then please provide me solution for that. I am waiting for your reply. If you are having any suggestion then please provide me that. |
|
#2
| ||||
| ||||
| Re: Creating Controls In A Loop
Hey, it is so simple to use. I have created below code which will allow you to create it. You need to check it, as I have not tested it. Code: for (int i = 0 ; I == 63 ; I + +)
{
System.Windows.Forms.Button button + i = new System.Windows.Forms.Button();
} |
|
#3
| ||||
| ||||
| Re: Creating Controls In A Loop
Hello, if you make use of the code below then you will able to get the solution for the dynamic control creation. So, just use the code below: Code: or (int J = 0; J < iCtr; J++)
ans = new HtmlInputText();
if (one == "0")
{
ans.Value =
ds.Tables["Answers"].Rows[J]["vStudyAText"].ToString).Trim();
}
ans.ID = "ans";
this.Controls.AddAt(this.Controls.IndexOf(PlaceHol der1), ans);
} |
|
#4
| ||||
| ||||
| Re: Creating Controls In A Loop
Hello, I think you need to use the code below which will create control in a loop. I have tested it, you can make use of it. Code: int x = 50;
int y = 50;
for (int i = 0 ; I <= 63 ; I + +)
{
System.Windows.Forms.Button b = new System.Windows.Forms.Button();
b.Name = "Button"+ I.ToString();
b.Rentals = new Item(x, y);
b.Text = "text button";
this.Controls.add(b);
y + = 50; / / define
} |
|
#5
| ||||
| ||||
| Re: Creating Controls In A Loop
Hello, simply make use of the book below and you will able to get the solution for your problem:
|
|
#6
| |||
| |||
| Re: Creating Controls In A Loop
Hello, you need to make use of the following namespace: * System * System.Web * System.Web.UI * System.Web.UI.HtmlControls * System.Web.UI.WebControls * System.Collections * System.IO |
![]() |
|
| Thread Tools | Search this Thread |
| |
Similar Threads for: "Creating Controls In A Loop" | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Watercooling: Single loop or Dual Loop | Akolekar | Hardware Peripherals | 3 | 21-10-2011 11:52 PM |
| Reboot Loop in Windows 7 Reboot loop and Safe mode doesn't work | mADiRAkSHii | Operating Systems | 4 | 25-01-2011 07:23 PM |
| Which is best for iterator: For loop or while loop | Leeland | Software Development | 4 | 18-01-2010 06:03 PM |
| Differentiate between Do-While loop and While loop | REDBULL | Software Development | 3 | 26-11-2009 10:10 AM |
| Creating dynamic controls with events | Gefry | Software Development | 3 | 11-05-2009 09:54 PM |