download
order  

Constant Builder

 
Accessibility Name DataType Value Description Module OK OK  New Cancel Help

Declares constants without moving from the current position. The constant is added at the top of the procedure or in the declaration section of a selected module. A copy can be pasted at the current position using ctrl-v, the place where you actually use it. The builder saves time by:

  1. not having to move to the declaration section and back
  2. copying the constant so it is available thru clipboard (ctrl-v)
  3. automatically selecting type based on used prefix in name.
  4. pick up name from selected text
  5. replaces selected text by name as used in builder

Example: If in module selected text is:

Resource Management

then in the Constant Builder it would be picked up as

csRESOURCEMANAGEMENT (and value 'Resource Management')

After OK the following insertion takes place

Const csRESOURCEMANAGEMENT As String = "Resource Management"
 
csRESOURCEMANAGEMENT
 
Note: the exact behavior can be changed in Settings

Start this dialog from Toolbar or using Alt-CCA (Code-vb - Constant - Add) or via Code-VB dock-able window.

Alternative: use fast declaration if you only need simple procedure level constants thru menu: Constant > {constant type}

Controls:


Accessibility

Select if a constant is to be Public or Private or procedure or module level.

Name

If you use prefix (lowercase) the builder will automatically try to interpret type and level. Prefixing behavior can be changed in the Settings dialog. Here you can also set if the constant name should always be uppercase.

DataType

Select the type of the constant. While entering characters the type gets selected incrementally. Selecting type may change prefix. Prefixing behavior is defined in the Settings dialog.

Value

If you pre-selected text in the module, both the name and the value field get that text as initial value.
This is useful if you want to move strings out of the code to constants for code refactoring. E.g.
strProfile = "Mark"

would then become

Const strMARK = "Mark"
strProfile = strMARK

or something close to this, you can alter the defaults to your liking, but this default behavior is likely to save you some typing effort.

Description

For those professional developers who take documenting code seriously :). The description is added after the declaration, e.g.

Dim sFile as String ' File to be processed

Module

If you use global constants (accessibility) and keep them in an other then the current module. You can select this module here, which saves you a trip to the other module and back.

OK

Creates the constant in the declaration section.

OK & Paste

Creates the constant in the declaration section and pastes it at the cursor position.

Cancel

Closes the builder without creating the constant.

Help

Starts this Help topic