C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Forums » .NET » ASP.NET »

How to exit for loop in condion


Posted Date: 03 Nov 2009      Posted By: Umar      Member Level: Gold     Points: 1   Responses: 4



hello friends how to exit for loop in the if statement
i am using like but its not working

for (int intLoopCounts = 0; intLoopCounts < strDtCount; intLoopCounts++)
{
if (Convert.ToInt32(dtNew.Rows[intLoopCounts]["netto"].ToString())*-1 > 0)
{
Flag = true;
break;
}
}

if control goes in if condition then i want to exit forloop and come out for loop

please help me



Thanks & Regards
Umar Daraj
umardaraj07@gmail.com
Software Engineer(Jaipur)





Responses

Author: Praveen    03 Nov 2009Member Level: DiamondRating: 2 out of 52 out of 5     Points: 2

hi,

break statement will come out from the loop

what error you are getting?



Author: lakshya    03 Nov 2009Member Level: GoldRating: 2 out of 52 out of 5     Points: 2

pls use breakpoints to check if it does go in if condition

Happy dotneting Spread Smiles :-)
Visit Lakshya



Author: venkatesan    03 Nov 2009Member Level: DiamondRating: 2 out of 52 out of 5     Points: 2

use exit sub

Regards,
M.Venkatesan.
Dot Net Code Snippets



Author: greeny_1984    03 Nov 2009Member Level: DiamondRating: 2 out of 52 out of 5     Points: 2

Hi,

You can try like this


for (int intLoopCounts = 0; intLoopCounts < strDtCount; intLoopCounts++)
{
if (Convert.ToInt32(dtNew.Rows[intLoopCounts]["netto"].ToString())*-1 > 0)
{
Flag = true;
return ;
}
}



Regards,
Greeny_1984

Rate this Response[Excellent/Good/Poor]
FRESHERS check this link
Need help from me join here



Post Reply
You must Sign In to post a response.
Next : Difference
Previous : Asp Menu
Return to Discussion Forum
Post New Message
Category: ASP.NET

Related Messages



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use