TEAM CODING-BCA

VB program to implement swap using function.

SWAPING  USING  FUNCTION



Public Function swap(ByRef a As Integer, ByRef b As Integer)
Dim t As Integer
t = a
a = b
b = t

End Function

Private Sub Command1_Click()
Dim n1 As Integer
Dim n2 As Integer
Dim n3 As Integer
n1 = Val(Text1.Text)
n2 = Val(Text2.Text)
n3 = swap(n1, n2)
Text3.Text = n1
Text4.Text = n2

End Sub

No comments:

Post a Comment