Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Visual Basic Quickstart Guide

You're reading from   Visual Basic Quickstart Guide Improve your programming skills and design applications that range from basic utilities to complex software

Arrow left icon
Product type Paperback
Published in Oct 2023
Publisher Packt
ISBN-13 9781805125310
Length 238 pages
Edition 1st Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
Aspen Olmsted Aspen Olmsted
Author Profile Icon Aspen Olmsted
Aspen Olmsted
Arrow right icon
View More author details
Toc

Table of Contents (27) Chapters Close

Preface 1. Part 1:Visual Basic Programming and Scripting FREE CHAPTER
2. Chapter 1: The Visual Basic Family of Programming Languages 3. Chapter 2: Console Input and Output 4. Chapter 3: Data Types and Variables 5. Chapter 4: Decision Branching 6. Chapter 5: Iteration 7. Chapter 6: Functions and Procedures 8. Chapter 7: Project Part I 9. Part 2:Visual Basic Files and Data Structures
10. Chapter 8: Formatting and Modifying Data 11. Chapter 9: File Input and Output 12. Chapter 10: Collections 13. Chapter 11: Project Part II 14. Part 3:Object-Oriented Visual Basic
15. Chapter 12: Object-Oriented Programming 16. Chapter 13: Inheritance 17. Chapter 14: Polymorphism 18. Chapter 15: Interfaces 19. Chapter 16: Project Part III 20. Part 4:Server-Side Development
21. Chapter 17: The Request and Response Model 22. Chapter 18: Variable Scope and Concurrency 23. Chapter 19: Project Part IV 24. Chapter 20: Conclusions 25. Index 26. Other Books You May Enjoy

Understanding parameters in functions and procedures

Parameters are used in VB to pass values or objects to a function or procedure when it is called. Parameters are specified in the function or procedure definition and are used to define the inputs required by the function or procedure. Here’s an example of a function with two parameters:

Function myMult(n1 As Integer, n2 As Integer) As Integer
    Dim m As Integer
    m = n1 * n2
    myMult = m
End Function

In this example, the myMult function takes two integer parameters, n1 and n2. The function uses these parameters to multiply them, which is returned as an integer value.

You must pass in the required values or objects when calling a function or procedure that takes parameters. Here’s an example of calling the myMult function:

Dim res As Integer
res = myMult(7, 8)
Console.WriteLine("Result: " & res)
*

In this example, the myMult...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image