Skip to main content This browser is no longer supported. Show
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support. Procedures in Visual Basic
In this articleA
procedure is a block of Visual Basic statements enclosed by a declaration statement ( Calling a ProcedureYou invoke a procedure from some other place in the code. This is known as a procedure call. When the procedure is finished running, it returns control to the code that invoked it, which is known as the calling code. The calling code is a statement, or an expression within a statement, that specifies the procedure by name and transfers control to it. Returning from a ProcedureA procedure returns control to the calling code when it has finished running. To do this, it can use a Return Statement, the appropriate Exit Statement statement for the procedure, or the procedure's End <keyword> Statement statement. Control then passes to the calling code following the point of the procedure call.
Parameters and ArgumentsIn most cases, a procedure needs to operate on different data each time you call it. You can pass this information to the procedure as part of the procedure call. The procedure defines zero or more parameters, each of which represents a value it expects you to pass to it. Corresponding to each parameter in the procedure definition is an argument in the procedure call. An argument represents the value you pass to the corresponding parameter in a given procedure call. Types of ProceduresVisual Basic uses several types of procedures:
Procedures and Structured CodeEvery line of executable code in your application must be inside some procedure, such as Procedures are useful for performing repeated or shared tasks, such as frequently used calculations, text and control manipulation, and database operations. You can call a procedure from many different places in your code, so you can use procedures as building blocks for your application. Structuring your code with procedures gives you the following benefits:
See also
FeedbackSubmit and view feedback for Additional resourcesAdditional resourcesIn this articleWhat language is based on a set of very specific rules for communicating?-A programming language is a set of rules for communicating an algorithm. -It provides a linguistic framework for describing computations. A programming language is : -A notational system for describing computation in a machine-readable and human-readable form.
Which of the following are used to describe the syntax of a programming language formally?Formal language-generation mechanisms, usually called grammars, are commonly used to describe the syntax of programming languages.
What reads the MSIL code and causes the program instructions to be executed?After the compiling process is complete and a program is ready for execution, the MSIL reads the CLR in RAM in a form that allows the computer's CPU to execute the instructions in the program.
Are people skilled in designing computer programs and creating them using programming languages?A programmer, or software developer, is a person with the training and skills necessary to design, create, and test computer programs.
|