Difference between Private Sub, Function and Class

vb.netAccess Modifiers

vb.net Problem Overview


What are the differences between the following:

  • Private Sub
  • Private Function
  • Private Class

When should each one be used?

vb.net Solutions


Solution 1 - vb.net

Private is a modifier than gives the scope of the class, sub, or function.

A sub and a function are both subroutines, or sections of code that can be called in the program. The difference between them is that a function has a return value and a sub does not.

A class is a group of codes that can include subs, functions, and other stuff.

Solution 2 - vb.net

Sub is like a function but it doesnt returns any values it just executes a proccess

Solution 3 - vb.net

Class is a Class, Sub and Function are methods, private is an access modifier

now check this link,

http://msdn.microsoft.com/en-us/library/ms973814.aspx

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionFurqan SehgalView Question on Stackoverflow
Solution 1 - vb.netxpdaView Answer on Stackoverflow
Solution 2 - vb.netAlejandroView Answer on Stackoverflow
Solution 3 - vb.netA_NabelsiView Answer on Stackoverflow