Register on the forum now to remove ALL ads + popups + get access to tons of hidden content for members only!

Go Back   Site Owners Forums - Webmaster Forums > Web Programming > Programming General > ASP


Thread Tools Rate Thread Display Modes
Old 01-17-2017, 10:32 PM   #1
Registered User
Join Date: Dec 2013
Location: Banglore
Posts: 336
Send a message via AIM to chinmay.sahoo Send a message via MSN to chinmay.sahoo
Arrow What is the main difference between sub-procedure and function?

The sub-procedure is a block of multiple visual basic statements within Sub and End Sub statements. It is used to perform certain tasks, such as changing properties of objects, receiving or processing data, and displaying an output. You can define a sub-procedure anywhere in a program, such as in modules, structures, and classes.

We can also provide arguments in a sub-procedure; however, it does not return a new value. The function is also a set of statements within the Function and End Function statements. It is similar to sub-procedure and performs the same task. The main difference between a function and a sub-procedure is that sub-procedures do not return a value while functions do.

Asthi jivak | Fat Cutter | Hot Shaper | Asthijivak
chinmay.sahoo is offline   Reply With Quote

Old 03-16-2017, 12:08 AM   #2
Registered User
Join Date: Jan 2017
Location: Ahmedabad
Posts: 126

In programming languages Functions and Procedure are the code segments written separately to take advantage of reusability. If you want write the same code segments many places in the programming file, it is likely that your program would benefit from Functions or Procedures , rather than duplicating code segments in multiple places.

Functions returning values after processing are called Functions and functions returning no value are called Sub Procedures. The Sub procedure performs a task and then returns control to the calling code, but it does not return a value to the calling code.

function sample

int add(int a, int b)
int result = 0;
result a+b;
return result;

Sub Procedure sample

Private Sub add(ByVal a As Integer, ByVal b As Integer)
Dim result As Integer
result = a + b
MsgBox("Result is " & result) //here Sub do not return the result
End Sub

Sonvi Belani
Ecommerce Website Developer
custom software companies India
ASP.NET software companies India
sonvi.belani is offline   Reply With Quote

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

All times are GMT -7. The time now is 03:11 PM.

Powered by vBulletin Copyright © 2013 vBulletin Solutions, Inc.