Loops in C# .Net

Ratings:
(4)
Views: 604
Banner-Img
Share this blog:

 

Loops

Syntax of for loop

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

{

Statements;

}

While Syntax

While (condition)

{

Statements ;

}

Do While Syntax

Do

{

Statements ;

}

While (condition)

These core tutorials will help you to learn the fundamentals of .NET. For an in-depth understanding and practical experience, explore Online ".NET Training"

 

Example on for loop

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

  Screenshot_21

  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 ();

location = new point (100,x);
this. Controls .Add (t);

x = x + 30;

}

Press f5

Execute the project

Check Out .NET Tutorial

  Screenshot_22

Observations

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

You liked the article?

Like: 0

Vote for difficulty

Current difficulty (Avg): Medium

EasyMediumHardDifficultExpert
IMPROVE ARTICLEReport Issue

About Author

Authorlogo
Name
TekSlate
Author Bio

TekSlate is the best online training provider in delivering world-class IT skills to individuals and corporates from all parts of the globe. We are proven experts in accumulating every need of an IT skills upgrade aspirant and have delivered excellent services. We aim to bring you all the essentials to learn and master new technologies in the market with our articles, blogs, and videos. Build your career success with us, enhancing most in-demand skills in the market.

Stay Updated
Get stories of change makers and innovators from the startup ecosystem in your inbox