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

Add procedures to module - Visual Basic Tutorial

From the course: Visual Basic Essential Training

Start my 1-month free trial

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