From the course: Visual Basic Essential Training
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Add procedures to module - Visual Basic Tutorial
From the course: Visual Basic Essential Training
Add procedures to module
- [Narrator] Procedures are declared in modules or classes. We'll look at how to add subs and functions to a module. These procedures are both useful. I'll focus on functions for most of this chapter however. To add a module to a project, right-click on it and choose add module. Here you'll give your module a name and then click on add. I've already done that so I'll cancel out of this dialog and this is the file that I created, NumberGenerator.vb And you see at the top is has the module declaration, the name of my module, and then on line three there's the end module. To add a sub to this module I'll start by typing in the access modifier, public or private. Then the word sub. Then a name for my sub. And then I'll press the enter key. Visual Studio stubs in the rest. It's the same for a function. I also need to add the return data type. I'll make this an integer, and then press enter. I have two squiggles. I have…
Contents
-
-
-
-
-
-
-
-
-
-
Understand procedures and methods3m 42s
-
(Locked)
Add procedures to module3m 35s
-
(Locked)
Call procedures from the application1m 27s
-
(Locked)
Add procedures to class1m 50s
-
(Locked)
Add code to functions2m 22s
-
(Locked)
Use parameters with procedures4m 37s
-
(Locked)
Challenge: Refactor with parameters1m 14s
-
(Locked)
Solution: Refactor with parameters3m 9s
-
-
-
-
-
-
-