What are the Sub Procedures in VB 6.0?
Hello guys, I wanted to the term Sub Procedures in VB 6.0 which is been very complicated to me. I tried to understand but every time I try I end up knowing nothing. I have a test next week so, I am trying to get this concept but every time I try I end up with a new problem. I don’t know what to do? If Anyone who knows the solution to this query then please let me know as I am very keen to know the concept of sub procedures in VB 6.0. Anyone having any knowledge about this query, then please let me know.
Re: What are the Sub Procedures in VB 6.0?
A Sub Procedure is a procedure which performs actions. It is used when the same code is used repeatedly at different places. Using a procedure makes the code readable and shorter. They make debugging and testing easier. This is used by a programmer when he/she is coding a project which is quite big. I think that sub procedures are one the important part while a programmer is coding a project in visual basic. One should use sub procedures when they are coding a project in a visual basic.
Re: What are the Sub Procedures in VB 6.0?
You can create a sub procedure in visual basic 6.0 which quite simple. Creating a New Sub Procedure Steps to create a new Sub is as follows:
Procedure: 1. Display the code window for the form.
Procedure: 2. Select Add Procedure from the Tools menu.
Procedure: 3. Enter a name in the Add Procedure dialog box.
Procedure: 4. Select the Type as Sub.
Procedure: 5. Select the type of Scope (Private or Public)
Procedure: 6. Click OK.
Re: What are the Sub Procedures in VB 6.0?
The arguments to be passed are specified in parenthesis after the name of the procedure. Multiple arguments can be specified by separating them with commas. If the Optional keyword is specified, passing that argument is optional. All Optional arguments must be to the right. If By Val is specified, a copy of the value of variable is passed to the Procedure. Thus, if the procedure modifies the value of the argument, the value of the passed variable remains unchanged.
Re: What are the Sub Procedures in VB 6.0?
If ByRef is specified, the reference of the variable is passed to the Procedure. Thus, if the procedure modifies the value of the argument, the value of the passed variable also changes. ByRef is default. viii. ArgName is any valid identifier used to access the argument in the scope of the procedure. Example Private Sub Sum(X As Integer, Y As Integer) Me. Print X + Y End Sub The above procedure prints the sum of its arguments viz. X and Y on the form.