Difference between a sub and a function?

Answers were Sorted based on User's Feedback



Difference between a sub and a function?..

Answer / m.sivakumar

A Sub Procedure is a method will not return a value
A sub procedure will be defined with a Sub keyword
Sub ShowName(ByVal myName As String)
Console.WriteLine (My name is: & myName)
End Sub

A function is a method that will return value(s).
A function will be defined with a Function keyword
Function FindSum(ByVal num1 As Integer, ByVal num2 As Integer)
As Integer
Dim sum As Integer = num1 + num2
Return sum
End Function

Is This Answer Correct ?    21 Yes 2 No

Difference between a sub and a function?..

Answer / satishdubey

A Sub Procedure is a method will not return a value
A sub procedure will be defined with a Sub keyword
Sub ShowName(ByVal myName As String)
Console.WriteLine (My name is: & myName)
End Sub

A function is a method that will return value(s).
A function will be defined with a Function keyword
Function FindSum(ByVal num1 As Integer, ByVal num2 As
Integer)
As Integer
Dim sum As Integer = num1 + num2
Return sum
End Function

Is This Answer Correct ?    7 Yes 4 No

Post New Answer

More VB.NET Interview Questions

I want to reduce my CPU Usage when I am querying the Database for records. Now my Winform App(in VB.Net) suddenly Jumps to 100% CPU Usage when i query for records from sql server database. I want this Usage to be less. Any help is appreciated

2 Answers  


Which dll is used for microsoft .net run time?

0 Answers  


What are the similarities between class and structure?

5 Answers   Ksb, L&T,


Define serialization in .net?

0 Answers  


Explain the difference between value and reference types?

0 Answers  






What are nested classes?

0 Answers  


Allowed program to auto-correct the database when loading a presentation.

0 Answers   HCL,


hello dear friends my problem is that i want to save images that is pictures in SQL server using vb.net can any body help me to do so please

1 Answers  


What is VB.Net?

3 Answers   Ksb,


is it possible to use flexgrid in vb dotnet?

9 Answers   Banking, Microsoft, NetBIOS,


what are the advantage in vb.net and different between vb and vb.net

6 Answers   Data Entry Operator, Infosys, TCS, Zansa,


How to create a constant in vb.net?

0 Answers  


Categories