Walk Lightly on this PLANET and yet leave such a FOOTPRINT that cannot be erased for thousands of Years..!!!
Visit Codstech for Cyber Security related Posts !

Visitors

Thursday, August 11, 2011

VB-102 : Declare a function(Pass by reference)

 To declare a function (Pass by reference Method)
(Taken from VB-Tutorial CDs ..)


Refer  Add 2 numbers(Pass by Value method)
Refer the same program in normal programming code : Simple Programs(3) 


(A)Program Design : 


(B) Property(Controls Used) :
  • 3 Labels,3 TextBoxes , One Command Button

(C) Attaching Code to the Object :

Private Sub Command1_Click()
Dim answer As Integer
answer = Add(Val(Text1), Val(Text2))
Text3.Text = answer
End Sub
---------------------------------------------------------------------------------------------------------
Public Function Add(ByRef first As Integer, ByRef second As Integer) As Integer
Dim f As Integer
f = first + second
Add  =  f
End Function




(E) Errors :
If found any errors while running your VB program, or want to put your comment about any  program , please click Comment section , to post.
====================================================================

===========================================================

No comments: