[tds_menu_login inline="yes" guest_tdicon="td-icon-profile" logout_tdicon="td-icon-log-out" show_menu="yes" toggle_txt="Your Profile" menu_uh_padd="12px 20px" menu_ul_padd="12px 20px" menu_ulo_padd="12px 20px" menu_gc_padd="12px 20px" menu_gh_padd="15px 20px" menu_uh_color="var(--lc-primary)" menu_uh_border_color="var(--lc-lgrey-c1)" menu_bg="var(--lc-greyish)" menu_ul_link_color="var(--lc-black)" menu_ul_link_color_h="var(--lc-primary)" menu_ul_sep_color="var(--lc-lgrey-c1)" menu_uf_txt_color="var(--lc-black)" menu_uf_txt_color_h="var(--lc-primary)" menu_uf_icon_color="var(--lc-black)" menu_uf_icon_color_h="var(--lc-primary)" menu_uf_border_color="var(--lc-lgrey-c1)" f_uh_font_family="sans-serif_global" f_links_font_family="sans-serif_global" f_uf_font_family="sans-serif_global" f_uh_font_size="14" f_links_font_size="14" f_uf_font_size="14" f_uf_font_line_height="1.2" f_links_font_line_height="1.2" f_uh_font_line_height="1.2" f_uh_font_weight="500" f_links_font_weight="400" f_uf_font_weight="500" menu_ul_sep_space="0" menu_ul_space="10" f_gh_font_family="sans-serif_global" f_btn1_font_family="sans-serif_global" f_btn2_font_family="sans-serif_global" show_version="" toggle_txt_color="var(--lc-black)" toggle_txt_color_h="var(--lc-primary)" icon_color="var(--lc-black)" icon_color_h="var(--lc-primary)" f_toggle_font_family="sans-serif_global" f_toggle_font_transform="" f_toggle_font_size="eyJhbGwiOiIxNiIsInBvcnRyYWl0IjoiMTQifQ==" f_toggle_font_line_height="1.2" f_toggle_font_weight="600" menu_arrow_color="var(--lc-greyish)" menu_border_color="var(--lc-greyish)" menu_shadow_shadow_size="0" menu_shadow_shadow_offset_vertical="0" f_gh_font_size="14" f_btn1_font_size="14" f_btn2_font_size="14" f_btn2_font_line_height="1.2" f_btn1_font_line_height="1.2" f_gh_font_line_height="1.2" menu_gh_color="var(--lc-primary)" menu_gh_border_color="var(--lc-lgrey-c1)" menu_gc_btn1_bg_color="var(--lc-lgrey-c1)" menu_gc_btn1_bg_color_h="var(--lc-primary)" menu_gc_btn1_color="var(--lc-black)" menu_gc_btn1_color_h="var(--lc-white)" menu_gc_btn1_border_color="var(--lc-lgrey-c1)" menu_gc_btn1_border_color_h="var(--lc-primary)" menu_gc_btn2_color="var(--lc-black)" menu_gc_btn2_color_h="var(--lc-primary)" f_gh_font_weight="500" f_btn2_font_weight="500" f_btn1_font_weight="500" menu_gh_txt="Explore account options." icon_size="20" avatar_size="20" disable_dropdown="yes" tdc_css="eyJhbGwiOnsibWFyZ2luLWJvdHRvbSI6IjAiLCJwYWRkaW5nLXJpZ2h0IjoiMjAiLCJib3JkZXItY29sb3IiOiJ2YXIoLS1sYy1kYXJrLWJsdWUpIiwiZGlzcGxheSI6IiJ9fQ=="]

Become a member

Get the latest updates and tutorials relating to Artificial Intelligence (AI).

― Advertisement ―

How to Write Engaging Blogs People Want to Read

Tips and tricks to write engaging blogs. From understanding your audience to SEO optimization, this guide covers it all.
HomeArchiveVisual Basic Project Files Structure

Visual Basic Project Files Structure

Microsoft VB has been a popular and powerful development environment for the Windows Platform. It has emerged since VB 1 for MS DOS and now the robust VB 6 and VB.NET is in action. The Basic unit for the VB programs is the Project.

The project has a number of units which are forms, MDI forms, Standard Modules, Class Modules, User defined ActiveX controls, Property Pages for these controls and ActiveX designers such as Data Report, WebClasses, DataEnvironment, DHTML Pages, UserConnections, Resource files and other related files.

These files look pretty in VB development environment, but very limited people know that these are the simple ASCII text files. Such files can be produced by a simple text editor such as notepad. These files have a simple structure that is very easy to understand. These files are discussed in a little detail below.

Project Files
Look at the following lines. These lines completely describe the contents of the Standard EXE project.

#2.0#0#….SYSTEMstdole2.tlb#OLE Automation
Module=Module1; Module1.bas
Class=Class1; Class1.cls

The first line, Type describes the type of the project. It is EXE for Standard EXEs, oleEXE for ActiveX EXEs, oleDLL for ActiveX DLLs, CONTROL for ActiveX control. The other line gives the first form file. The reference line gives the reference to the file added from the references dialog box. It specifies the GUID and filenames for the components. The next lines give the project components and their filenames. For instance, the project has a standard module, a usercontrol, a class and the startup object is form1. The next lines set the options in the project properties dialog box, which are the project name, HelpContextID, The Compatibility options, Version number options, the state of Remote server Files option, the compilation type (in this instance, Native code), the optimization type (Optimize for fast code here), The value for Favour Pentium Pro and Create symbolic debug info checkboxes. The next six lines set the value for advanced optimization options.

The Next line sets the Startup Mode for ActiveX components. It is always 0 for standard EXE Projects. The Next 4 lines return to the General tab and set the values for Unattended Execution, Retained in memory options and the Threading options for ActiveX components.

Form Files
The form file contains the necessary references to controls and the code contained in the form. Look at the following text of a typical form file with a command button, a textbox and some code.

Begin VB.Form Form1
    Caption = “Form1”
    ClientHeight = 3195
    ClientLeft = 60
    ClientTop = 345
    ClientWidth = 4680
    LinkTopic = “Form1”
    ScaleHeight = 3195
    ScaleWidth = 4680
    StartUpPosition = 3 ‘Windows Default
    Begin VB.CommandButton Command1
        Caption = “Command1”
        Height = 495
        Left = 1800
        TabIndex = 1
        Top = 1320
        Width = 1215
    Begin VB.TextBox Text1
        Height = 495
        Left = 360
        TabIndex = 0
        Text = “Text1”
        Top = 240
        Width = 1215

Attribute VB_Name = “Form1”
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False

Private Sub Command1_Click()
    Text1.Text = “Hello World”
End Sub
Private Sub Form_Load()
    Text1.BackColor = vbBlue
End Sub

The first line describes the form module version. The next line marks the start of the form named form1. The next lines up to startup position set the properties of the form. Caption, Height, Left, Top, Width, LinkTopic, ScaleHeight, ScaleWidth, and StartUp Position.

The next line marks the Start of CommandButton, Command1. The next lines set the familiar properties of the command button. The same is with the lines specifying the textbox. Finally the form definition is ended and some advanced properties are set and finally the code is listed as it is.

Module Files
The Module files are a simple listing of the code with only a simple property, the Name. Below is a simple Module file, with an empty sub main.

Attribute VB_Name = “Module1”
Sub main()
End Sub

User Control Files
The usercontrols are the ActiveX controls created by the developers. Their file format is very similar to the form file. Below is a simple Empty usercontrol file.

Begin VB.UserControl UserControl1
    ClientHeight = 3600
    ClientLeft = 0
    ClientTop = 0
    ClientWidth = 4800
    ScaleHeight = 3600
    ScaleWidth = 4800
Attribute VB_Name = “UserControl1”
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False

Class Files
    MultiUse = -1 ‘True
    Persistable = 0 ‘NotPersistable
    DataBindingBehavior = 0 ‘vbNone
    DataSourceBehavior = 0 ‘vbNone
    MTSTransactionMode = 0 ‘NotAnMTSObject

Attribute VB_Name = “Class1”
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Public Property Get msg() As Variant
End Property
Public Property Let msg(ByVal vNewValue As Variant)
End Property

It is a simple class with just 1 property, msg. The properties of the class are contained between the BEGIN and END block. The rest apply only to ActiveX servers. They are just the instancing and persisting properties.

UserDocument Files
Begin VB.UserDocument UserDocument1
    ClientHeight = 3600
    ClientLeft = 0
    ClientTop = 0
    ClientWidth = 4800
    HScrollSmallChange= 225
    ScaleHeight = 3600
    ScaleWidth = 4800
    VScrollSmallChange= 225
Attribute VB_Name = “UserDocument1”
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = True
Option Explicit

This is very similar to the Usercontrol and the Class file. The userdocuments are used to create applications for the web.

MC MCSE is a popular computer certification website devoted to providing free learning materials to candidates pursuing Microsoft, CompTIA and Cisco certifications. To access these resources visit http://www.mcmcse.com


Please enter your comment!
Please enter your name here