Professional Documents
Culture Documents
Classes and Member Access Modifiers
Classes and Member Access Modifiers
access modifiers
Functions and Sub procedures /
Programs in VB .NET (Methods)
Functions and sub procedures must either have a sub or function keyword in the function or
sub procedure heading
They can be either public or private (following the same conventions in OOP languages such as
C++ or Java)
All parameters are passed by value by default in VB .Net
Parameters of any data type may be passed by reference
All Objects and arrays are passed by reference not value
All events are handled by a sub procedure in VB .Net
Functions return a value and Sub Procedures do Not
Function FindMax(ByVal num1 As Integer, ByVal num2 As Integer) As Integer
Dim result As Integer
class Class1
Dim x as integer
Public y as integer
End Class
CLASS IN VB.NET
Public
Private
Protected
Friend
ProtectedFriend
FUNCTION AND SUB PROCEDURES
[access-modifier]Function <function-name>(parameterlist)
As type
[access-modifier]sub <sub-procedure-name>(parameterlist)
As type
Sub procedure body
End Sub
Creating Objects