Wrox Programmer Forums
ASP.NET 3.5 Basics If you are new to ASP or ASP.NET programming with version 3.5, this is the forum to begin asking questions. Please also see the Visual Web Developer 2008 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 3.5 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old January 10th, 2011, 02:54 PM
Registered User
Join Date: Oct 2009
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to ritesh7 Send a message via Yahoo to ritesh7
Default exit sub in C#

i have the following code

protected void btnSelect_Click(object sender, EventArgs e)
int count = 0;
foreach (GridViewRow i in gvDetails.Rows)
CheckBox chk = new CheckBox();
chk = (CheckBox)i.FindControl("chkSelect");
if (chk.Checked == true)
count = count + 1;

if (count ==0)
lblMessage.Text = "Please select a student First";


in the above c# code I want to exit from the event if count ==0 so what statement should I give next. In vb I can give exit sub what in case of C# pls help me asap
Old January 10th, 2011, 06:41 PM
samjudson's Avatar
Friend of Wrox
Join Date: Aug 2007
Posts: 2,128
Thanks: 1
Thanked 189 Times in 188 Posts

Your biggest tool as a developer is the ability to learn for yourself.

In this instance what you need to learn is how to use Google (or any other popular search engine).
/- Sam Judson : Wrox Technical Editor -/

Think before you post: What have you tried?

Similar Threads
Thread Thread Starter Forum Replies Last Post
how to exit from for-each vijay_bablani XSLT 3 April 26th, 2010 07:33 AM
on exit mohiddin52 Access VBA 2 July 10th, 2007 09:28 AM
exit from for-each preethi.s XSLT 1 September 8th, 2006 05:37 AM
Exit Application King_ General .NET 0 February 23rd, 2006 10:30 AM
session_destroy on exit?? harmen_wessels PHP How-To 2 July 5th, 2003 09:41 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.