How to Name Objects in VB6 Programming ?

Monday, August 31, 2009 · 2 comments

When an object is created, a default name based on its object typed will be given to the object. For example Form1 will be given to object/control with type Form, Text2, Text3,... will be given to Textbox object, Command1, Command2,.... will be given to command button object. You should immediately change the name property of the object to a name that describes the purpose of the control. Changing the Name property of your object with a name that describe the purpose with the object will make the code in your application easier to read and debug.

Visual Basic has several Standard Naming Convensions. Although you can assign any name you want to an object, but it is a better to adopt a naming convension and use it ocnsistently throughout your programms. Because it will make easier for others to understand your code.

Here it is a list of Standard Naming Convensions used in Visual Basic that assign to each type object:

  • Object type: Check box
    The prefix you should use: chk
    Example name: chkDrink

  • Object type: Combo box
    The prefix you should use: cbo
    Example name: cboStore

  • Object type: Command button
    The prefix you should use: cmd
    Example name: cmdSelect

  • Object type: Data
    The prefix you should use: dat
    Example name: datSales

  • Object type: Directory list box
    The prefix you should use: dir
    Example name: dirImage

  • Object type: Drive list box
    The prefix you should use: drv
    Example name: drvSource

  • Object type: File list box
    The prefix you should use: fil
    Example name: filSource

  • Object type: Form
    The prefix you should use: frm
    Example name: frmEntry

  • Object type: Frame
    The prefix you should use: fra
    Example name: fraOption

  • Object type: Grid
    The prefix you should use: grd
    Example name: grdItem

  • Object type: Horizontal croll bar
    The prefix you should use: hsb
    Example name: hsbTemperature

  • Object type: Image
    The prefix you should use: img
    Example name: imgEmployee

  • Object type: Label
    The prefix you should use: lbl
    Example name: lblName

  • Object type: Line
    The prefix you should use: lin
    Example name: linHorizontal

  • Object type: List box
    The prefix you should use: lst
    Example name: lstCustomer

  • Object type: Menu
    The prefix you should use: mnu
    Example name: mnuReport

  • Object type: OLE
    The prefix you should use: ole
    Example name: oleObject2

  • Object type: Option button
    The prefix you should use: opt
    Example name: optCountry

  • Object type: Picture box
    The prefix you should use: pic
    Example name: picFlower

  • Object type: Shape
    The prefix you should use: shp
    Example name: shpSquare

  • Object type: Text box
    The prefix you should use: txt
    Example name: txtName

  • Object type: Timer
    The prefix you should use: tmr
    Example name: tmrStep

  • Object type: Vertical scroll bar
    The prefix you should use: vsb
    Example name: vsbRate


  • Project Types in Visual Basic

    Saturday, August 29, 2009 · 0 comments





















    A Visual Basic project is made up of the forms, code modules, ActiveX controls, and environmental settings required by an application (you can identify a Visual Basic project from it's extention name ".vbp"). The project lists all the files you need in your application.

    By default Visual Basic offers you several project templates designed to support the development of different kinds of applications and components. The project templates contain the basic project objects and environment settings you need to create the type of application or component you want to build. When you begin to develop an application, first you have to decide what project template you will use.

    By default you can select the following templates that available in Visual Basic:

  • Standard EXE
    By default Standard EXE projects contain a form, and you can use this project template to develop a stand-alone application.

  • Data Project
    You can use this project template to develop an application that reads or manipulates data from data sources.

  • ActiveX EXE/ActiveX DLL
    Use ActiveX EXE and ActiveX DLL project templates to develop COM components that expose functionality to other applications. You can use an ActiveX EXE project template if your component will both expose functionality programmatically and run as a stand-alone application. You can use an ActiveX DLL if your component will only be used programatically by another application.

  • ActiveX Control
    You can use ActiveX Control project template if you want to create a component that designed to be a user interface element in a form or a dialog box.

  • ActiveX Document EXE/ActiveX Document DLL
    You can use ActiveX Document EXE and ActiveX Document DLL if you want to create a component that designed for use in a document object container, such as Internet Explorer.

  • DHTML Application
    You can use DHTML Application project template if you want to create a component that can be used on the client side of a Web application.

  • IIS Application
    You can use IIS Aplication project template if you want to create a component that can be used on the server side of a Web application.

    You can create a new Visual Basic project with below steps:
  • Start your Visual Basic application
    The New Project dialog box appears.
  • Select the project template you want, then click Open button.

    Or you can follow below steps if your Visual Basic application already open:
  • Click File menu.
  • Click New Project menu.
    The New Project dialog box appears.


  • Select the project template you want, and then click OK button.



  • Common Terminology in Visual Basic

    Friday, August 28, 2009 · 0 comments

    Like another programming language, Visual Basic also has some common terminology that required to be understood by the developers (programmers). Here are some common terms in Visual Basic:

  • Design time
    Design time is any time when an application being developed in Visual Basic Development Environment

  • Run time
    Run time is any time when an application is running.

  • Forms
    Forms are windows that can be customized by the developer (programmer)

  • Controls
    Controls are graphic that representation of objects

  • Objects
    Object is a general term that used to describe forms and controls that make up a program

  • Properties
    Properties are the characteristics of objects such as size, width, height, etc

  • Methods
    Methods are the actions that object can perform

  • Events
    Events are the actions that recognized by forms or controls

  • Even-driven programming
    .......


  •