?
Solved

How do I use .bas files?

Posted on 1998-12-29
3
Medium Priority
?
792 Views
Last Modified: 2012-06-22
the question title is self explainatory. how do i use a .bas file after i dl it? how do i add it to the vb form? do i need to add code with the .bas files?
0
Comment
Question by:LearningVB
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 3

Accepted Solution

by:
vbWhiz earned 40 total points
ID: 1453099
A .bas file is simply a vb module file. To include the .bas file in your project you can use several methods.

Method 1:
  Open the windows explorer and your VB project. Drag & Drop the .bas file into the project explorer in VB (the area on the right panel that looks like the tree-view part of the windows explorer)

Method 2:
  Open the VB project. Right-Click in the project explorer panel. On the pop-up menu select add/module. A new window will pop open with two tabs. Click the 'existing' tab. Navigate through your files and find the .bas file to use.

Method 3:
  Open the VB project. On the button-bar across the top click the down-arrow next to the second button on the left (the tooltip for the button says 'new form'). A menu should appear. Click the 'new module' menu selection. . A new window will pop open with two tabs. Click the 'existing' tab. Navigate through your files and find the .bas file to use.


I hope this helps you out!
0
 

Author Comment

by:LearningVB
ID: 1453100
Thanx. When I figure out how to do this I'm sure it'll work... I think?
0
 
LVL 3

Expert Comment

by:vbWhiz
ID: 1453101
A visual basic module (.bas) can contain:

Variable Declarations

Functions

Subs

Constant Declarations

If any of these are declared public they can be used in the rest of your application.

This is some code that could exist in a VB module:

OPTION EXPLICIT

Private MyInt As Integer

Public MyString As String

Private Const HelloText = "Hello"

Public Const GoodByeText = "Goodbye"

Private Sub sayhello()

msgbox hellotext

end sub

Public Sub sayGoodbye()

msgbox goodbytext

end sub

Private Function AddFive(Value AS Integer) As Integer

AddFive = Value + 5

End Function

Public Function AddTen(Value As Integer) As Integer

AddTen = AddFive(AddFive(Value))

End Function



To See this sample work add a new module using one of the methods I described earlier but this time select 'New Module' rather than finding an existing one.

Copy&Paste the sample code into the new module.

Add a new form to the project.

Try adding a button and using the 'AddTen' Function on the click event.(SAMPLE CODE: Msgbox AddTen(35))

Try using some of the other functions and subs.

Notice that all things that are Private cannot be used in the form. Notice that all things that are public may be used freely on the form.


I hope this helps you understand modules better. In typical application developement a module is where you put common subs or functions that the rest of the program can use on demand.

Many times companies have several common modules that contain subs & functions that they use on many projects. In that case each new project they work on they already have pre-written code that they can take advantage of in any subsequent projects.

0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses
Course of the Month10 days, 10 hours left to enroll

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question