We will be undergoing scheduled maintenance on May 20th, 2013 at 02:00 GMT.
Visitors to VTC.com will be able to view all introductory videos for each training course.
Free Trial Members will gain access to first three chapters for each training course.
Full Access Members have full access to VTC.com�s entire library of video tutorials.
Now let's talk about a module, and I know you've had a lot of terms throw at you. And for somebody coming from a VB6 world, there is a lot of things happening and I am aware of that. So what I want to do in this video is explain a module to you, and I've put it here because a module tends to encapsulate everything we've talked about so far. And then I'm going to show you graphic to help you understand exactly how this works. First of all what is a module? It is a reference type and it's similar to a class. It's like a shared class and we'll talk about that in just a minute, it serves basically as code containers. This is very similar to the basic module that we had in Visual Basic 6, if you are a VB6'er. Those had the .bas code in .extension and we used those to put the code that everybody needed to get to, and that's exactly what a module does within our assemblies. Now these do differ from classes, in that all members, this means all of our methods, functions, variables are implicitly shared, we don't have to put the shared keyword, but they are implicitly shared. Because modules cannot be instantiated; we can't instantiate objects off of our models, our modules. So all of our members are explicitly shared out of there, we can use them without any instantiation. Now modules do not support interfaces. So we can't add interfaces into our modules, nor do our modules support inheritance. So, we can't inherit multiple levels or we can't have derived modules and so forth, like we can classes. And we can't implement interfaces since they are not supported, we also can't implement them and bring them in. Now, I want to stop right here and let's go back to the very beginning of where we've been with all these different constructs and talk about how these things fit together. Now we've talked about classes and namespaces and sub procedures and functions and overrides and overloads and shadows and so forth. Now let's kind of tie it all up a little bit. First of all, start off by writing some code and notice right here I've written two sub procedures, and one of these could easily have been a function and these are just representative of an application that I'm building. And I group those things by putting them into a class and this is class A. So now I can instantiate an object off of class A and have access to these two methods. Now I can create other classes and within the other classes have sub routines or methods even with the same names. But because of the class designations, they can be uniquely identified. I can group my classes into modules. And so in this example, module AA contains class A and class B and then the methods in those classes. Then my module can fall under a namespace, we talked about namespaces fairly early on in the course. And then we can create multiple name spaces with modules and classes inside and just continue to build this thing out as large as we want to. Then our namespaces and our modules and our classes are grouped into an assembly. And an assembly contains a manifest, which will explain or describe all of these pieces inside here to people on the outside who need to use this assembly. And so I wanted to give you a graphic picture of how these different pieces fit together. Now keep in mind, inside our classes, we can inherit from each of these classes, we can do overloads on our subs between the classes, across the namespaces and so forth. So there is an awful lot that can happen here, and I hope this helps you to kind of get a mental image of how these things fit together. Now notice in this, the whole point of this is the same thing, is to basically segregate sections of our code in an object oriented manner. So that we can manipulate these things efficiently. Now in the next video, I'm going to actually go into the visual studio environment and create a module and then create a second module and show you how we can use these things, and just kind of how they work from a code standpoint.
| Course: | Microsoft Visual Basic .NET |
| Author: | Mark Long |
| SKU: | 33433 |
| ISBN: | 1932072349 |
| Release Date: | 2003-05-27 |
| Duration: | 6 hrs / 87 lessons |
| Captions: | No |
| Compatibility: |
Vista/XP/2000, OS X, Linux QuickTime 7, Flash 8 |