Tuesday, August 27, 2013

How to use For loop in C#.net

In this articles i will show how to use looping statement in c#.net.In this examples A program to add to textBox at run time. Here i placed one button to perform click event.
code for button click
{
int x=30;
for(int i=1;i<=10;i++)
{TextBox txt=New TextBox();
txt.Text="Txxt"+i;
txt.Location=New Point(100,x);
This.Controls.Add(txt);
x=x+30;
}
In the above code i created 10 text box using for loop condition.The for loop condition takes maximum iteration up to 10 which i was given at condition


No comments:

Bel