How Can i write and pass the arguments in the VB6.0?
Hi,
You can do this by creating sub procedure or a function. Example:
1. Sub Procedure
Code:
Private Sub EnableControls(ByVal b As Boolean)
'A method that enables/disables textboxes
Text1.Enabled=b
Text2.Enabled=b
End Sub
Implementation
Code:
Private Sub Command1_Click()
EnableControls False ' or it can also done in this way [B]Call EnableControls(False)[/B]
End Sub
2. Function
Code:
Private Function Area(ByVal length As Integer, ByVal width As Integer) As Long
'A method that computes for the area of a rectangle
Area=length*width 'Passing the value of an area as long
End Function
Implementation
Code:
Private Sub Command1_Click()
Text1.Text=Area(Text2.Text, Text3.Text) 'Assuming Text2 is the length and Text3 is the width
End Sub
Note: Sub Procedure doesn't return any values when it is called Unlike for Function, it returns values according to its type.
Rey Sean
Last edited by lotus18; Dec 16 '08, 03:50 AM.
Reason: be
Comment