473,320 Members | 1,814 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

What is "Exit Sub" in C#?

What is the C# equivalent of VB.NET's Exit Sub?

Thanks,
Brett
Nov 17 '05 #1
7 98365
return;
"Brett" <no@spam.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
What is the C# equivalent of VB.NET's Exit Sub?

Thanks,
Brett

Nov 17 '05 #2
Nice. Thanks.

Does this mean there is no concept of a method in C#? Everything is a
function?

Brett

"Nicole Calinoiu" <calinoiu REMOVETHIS AT gmail DOT com> wrote in message
news:u$**************@TK2MSFTNGP09.phx.gbl...
return;
"Brett" <no@spam.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
What is the C# equivalent of VB.NET's Exit Sub?

Thanks,
Brett


Nov 17 '05 #3
Les
Brett,
Methods are just functions that belong to objects. You are correct, there
are just Objects and not independent functions.

"Brett" wrote:
Nice. Thanks.

Does this mean there is no concept of a method in C#? Everything is a
function?

Brett

"Nicole Calinoiu" <calinoiu REMOVETHIS AT gmail DOT com> wrote in message
news:u$**************@TK2MSFTNGP09.phx.gbl...
return;
"Brett" <no@spam.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
What is the C# equivalent of VB.NET's Exit Sub?

Thanks,
Brett



Nov 17 '05 #4
Not quite. In C#, there are simply methods that return values (functions in
VB) and those that don't (subs in VB). For example, the following two
procedures would be equivalent:

VB:
Public Sub DoesNothing()
Exit Sub 'Not required, but since it's what you originally asked
about... <g>
End Sub

C#:
public void DoesNothing()
{
return; // Not required here either.
}

"Brett" <no@spam.com> wrote in message
news:Ol**************@TK2MSFTNGP10.phx.gbl...
Nice. Thanks.

Does this mean there is no concept of a method in C#? Everything is a
function?

Brett

"Nicole Calinoiu" <calinoiu REMOVETHIS AT gmail DOT com> wrote in message
news:u$**************@TK2MSFTNGP09.phx.gbl...
return;
"Brett" <no@spam.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
What is the C# equivalent of VB.NET's Exit Sub?

Thanks,
Brett



Nov 17 '05 #5
Brett wrote:
What is the C# equivalent of VB.NET's Exit Sub?

Thanks,
Brett

Further to what everyone else has said, I would like to add that Exit
Sub is just a holdover from vb6 which should (my opinion) not be used as
Return (in vb.net) does the same thing and is more readable (especially
to non vb6 porgrammers).

I never liked the distinction between sub's and functions and think a
void return type is far cleaner and more readable.
Although I suppose
public function MyFunk() as void
is not that nice. :)

I suppose thats why I switched to c#.

My 2c

JB
Nov 17 '05 #6

"John B" <jb******@yahoo.com> wrote in message
news:42***********************@news.sunsite.dk...
Brett wrote:
What is the C# equivalent of VB.NET's Exit Sub?

Thanks,
Brett

Further to what everyone else has said, I would like to add that Exit Sub
is just a holdover from vb6 which should (my opinion) not be used as
Return (in vb.net) does the same thing and is more readable (especially to
non vb6 porgrammers).

I never liked the distinction between sub's and functions and think a void
return type is far cleaner and more readable.


In this case, it's being used to break program flow. Not for returning
anything.

Brett
Nov 17 '05 #7
Brett wrote:
"John B" <jb******@yahoo.com> wrote in message
news:42***********************@news.sunsite.dk...
Brett wrote:
What is the C# equivalent of VB.NET's Exit Sub?

Thanks,
Brett


Further to what everyone else has said, I would like to add that Exit Sub
is just a holdover from vb6 which should (my opinion) not be used as
Return (in vb.net) does the same thing and is more readable (especially to
non vb6 porgrammers).

I never liked the distinction between sub's and functions and think a void
return type is far cleaner and more readable.

In this case, it's being used to break program flow. Not for returning
anything.

Brett

Which is also what return is used for.
Either
Return
(returns nothing)
or
Return value
(value)

VB.NET would (i presume) give a compile error if you tried to actually
return a value in a "sub".

JB
:)
Nov 17 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

29
by: DraguVaso | last post by:
Hi, I'm having this error in a VB.NET-application at the moment that I attempt to read data from an SQL Server: The .Net Data SQL Provider (System.Data.SqlClient) requires Microsoft Data...
6
by: Clément Collin | last post by:
I working on a GIS project, with Access link which just need a little routine in VBA, but I haven't knowledges in VBA language. It's very simple, and it looks like that in a TPascal way : .......
1
by: Steve Long | last post by:
Hello, does anybody know if the built in support for the "Exit For" statement is just a left over from earier versions of VB and therefore inefficient or if it's truely a VB.NET language feature?...
0
by: mammucion | last post by:
Trying to automate processing 80,000 data sets through 15 web pages. Application URL creates a new IE instance in which runs first a login form and then runs the rest of the pages in the new...
2
by: dstork | last post by:
Anyone know how to rename the "Exit Access" command at the bottom of the Office menu. I'd like to rename it to "Exit" as I had done in previous versions of Access. I know I can disable it with ...
8
n8kindt
by: n8kindt | last post by:
how do i suppress the outputting and printing dialog boxes that pop up while running vba code such as: DoCmd.OpenReport "Report1" or DoCmd.OutputTo acOutputReport, "Report1", acFormatPDF,...
9
by: Keith G Hicks | last post by:
I'm having a lot of trouble with "file in use" errors in my "folder watcher" project. Starting and stopping the watcher and reading my XML file work fine. Once the watcher is started, I'm reading...
7
by: surferj | last post by:
Hello, I am trying to run a macro in that was created in an earlier version of access but getting an error message when i try to run it in 2007. The error occurs on the DoCmd.RunMacro...
6
sueb
by: sueb | last post by:
I'm implementing a report that has an entirely different first page than the rest of the pages (the first page gets printed on an original form, but the following pages have their much-more-simple...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.