• USA : +1 973 910 5725
  • INDIA: +91 905 291 3388
  • info@tekslate.com
  • Login

Loops in C# .Net


Syntax of for loop

For (initialization ;  condition , ++  (or) –)




While Syntax

While (condition)


Statements ;


Do While Syntax



Statements ;

} While (condition)

Example on for loop

Place a button on the form then Add 10 text boxes in to the form when clicked on a button




Open windows forms application project

Place a button

Code for button 1 click


Int X = 30;

For (int I =1; i<10; I++);


Text box t = new text box ();

  1. location = new point (100,x);

this. Controls .Add (t);

x = x + 30;


Press f5

Execute the project




In C # .net all the controls are predefined classes.


“At TekSlate, we are trying to create high quality tutorials and articles, if you think any information is incorrect or want to add anything to the article, please feel free to get in touch with us at info@tekslate.com, we will update the article in 24 hours.”

0 Responses on Loops in C# .Net"

    Leave a Message

    Your email address will not be published. Required fields are marked *

    Site Disclaimer, Copyright © 2016 - All Rights Reserved.


    Please leave a message and we'll get back to you soon.

    I agree to be contacted via e-mail.