Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > General > Modules?


Reply
 
Thread Tools Display Modes
  #1  
Old 06-16-2001, 11:32 PM
Defiance
Guest
 
Posts: n/a
Default 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..."
Reply With Quote
  #2  
Old 06-17-2001, 04:00 AM
Avenging_Angel
Guest
 
Posts: n/a
Default 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...

Reply With Quote
  #3  
Old 06-17-2001, 11:24 AM
matthewbeetle
Guest
 
Posts: n/a
Default 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.

Reply With Quote
  #4  
Old 06-17-2001, 11:47 AM
Defiance
Guest
 
Posts: n/a
Exclamation 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..."
Reply With Quote
  #5  
Old 06-18-2001, 12:41 AM
pratim_g
Guest
 
Posts: n/a
Default 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

Reply With Quote
  #6  
Old 06-18-2001, 07:15 AM
Laurent Laurent is offline
Senior Contributor

Retired Leader
* Expert *
 
Join Date: Apr 2001
Location: canada, quebec
Posts: 1,334
Default 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!
Reply With Quote
  #7  
Old 06-18-2001, 07:26 AM
ANUNEZ
Guest
 
Posts: n/a
Default 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

Reply With Quote
  #8  
Old 06-18-2001, 09:52 AM
Defiance
Guest
 
Posts: n/a
Cool 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>
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->