 |
 |

06-16-2001, 11:32 PM
|
|
|
Modules?
|
Ok, what is a module and what is it used for (I know I know, I'm dumb cause I don't know what a Module / Class Module is). Any help is appreciated!
<marquee scrollamount="10" scrolldelay="5" style="font-weight: bold; border: 9 groove #000080">Help Me!!!</marquee>
--Defiance
"Soon I will answer your questions, now you will answer mine..."
|
|

06-17-2001, 04:00 AM
|
|
|
Re: Modules?
|
well, i know that modules are using for declaring things publically...so that they can be accessed by anything in the project...
ie. variables, procedures, functions etc...
|
|

06-17-2001, 11:24 AM
|
|
|
Re: Modules?
|
All the forms in a project have access to a module. This means that you can write a piece of code in the module and then reference it from all the other forms in the project. This saves having long lines of undesirable code taking up the memory when your project is run.
|
|

06-17-2001, 11:47 AM
|
|
|
Re: Modules?
|
So a module is basically like a large General Declarations section, but has access to all forms?
"Soon I will answer your questions, now you will answer mine..."
|
|

06-18-2001, 12:41 AM
|
|
|
Re: Modules?
|
I think i can help you some way, well there are three types of modules in VB.
1) Class Module
2) Form Module
3) Standard Module
1) The first one is genreated to make some functions and procedures or properties or even events to function as defined. Can be used for ActiveX controls or some specific entities.
2) The second one is basically used normally. We have acess specifiers which define the area of operation for any variable or function or procedure. This is the normal form/s we use.
3) Standard module are those which are defined in the earlier post.
I hope i have given you a little more information about what you had aksed for.
Thanks..Pratim
|
|

06-18-2001, 07:15 AM
|
|
Senior Contributor
Retired Leader * Expert *
|
|
Join Date: Apr 2001
Location: canada, quebec
Posts: 1,334
|
|
Re: Modules?
|
i normaly use the modules for general functions with parameters, it's better not to make a reference directly to the form so that way you can re-use the function. take for example a tax function where you put this in the module
public function calculateTax(price as currency) as currency
calculateTax = price*1.15025
end function
and you can call it from all the text field in all your form after declaring an instance of the module like this
dim calculate as moduleName.className
set calculate = new className
private sub Text1.change()
text1.text=call calculateTax(CCur(text1.text))
end sub
I'll be among the best soon, very soon!!!
|
__________________
Still tons to learn!
|

06-18-2001, 07:26 AM
|
|
|
Re: Modules?
|
I see that you are clear of what modules are, then I'll explain a little about Classes.
Before object oriented programming there was structured programming. Structured programming is based on function to do a specific task, like retrieve a customer information or any other task. Structured programming is great, but it faces one problem and that is enhancement of the application. Let suppose that you create a function to represent cars, this function has variable to hold standards things for cars like four whiles, doors, lights, etc. Now let say that you want to make a convertible car, you have two choices, change the function completely or create a whole new function. If you change the old function, then it not compatible with the programs that were using this function before, but to create a new function you will have to make duplication of the code that defines a standard car. To solve this problem was created the object oriented programming which uses classes. Using classes you create a class that represent a standard car, and if you have to create a convertible car, then the only thing that you have to do is to enhance the standard class to create a class for convertible. In this way you won’t make duplicate code, and programs using the standard cars won’t have any conflict with the new class.
Some programmers says that VB is not really object oriented because it does not allow true inheritance. It does implement a class which is not the same.
I hope this help
|
|

06-18-2001, 09:52 AM
|
|
|
Re: Modules?
|
Wow, I didn't expect this many posts. Thanks a lot all of you!
--Defiance
"Soon I will answer your questions, now you will answer mine..."<P ID="edit"><FONT class="small"><EM>Edited by Defiance on 06/18/01 10:53 AM.</EM></FONT></P>
|
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
|
|
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|
|
|
|
 |
|