Windows CE Toolkit for Visual Basic 5.0 Start Page

Welcome to Windows CE!

Windows CE Toolkit for Visual Basic 5.0 contains all the tools you need to develop great applications for platforms that run Windows CE.

The Windows CE emulation environment and remote tools, built into the familiar Visual Basic development environment, can help you port existing applications or develop entirely new ones for a wide range of devices that run Windows CE.

The Windows CE documentation is now HTML-based. Start reading now by clicking on one of the categories you see at the right. Or use the InfoViewer Contents pane for a hierarchical view of the Table of Contents, much as it would appear in a printed book.

For the latest information about developing for Windows CE, visit the Microsoft Windows CE World Wide Web site, http://www.microsoft.com/ windowsce/developer.

Getting Started
Explains how to use the Windows CE Toolkit for Visual Basic 5.0. It contains information to get you up and running, developing applications, as quickly as possible.
Programmer's Guide
Provides detailed information about each of the Windows CE Remote Tools as well as information on the debugging environment.
Language Reference
The complete Windows CE Toolkit for Visual Basic 5.0 language reference.
Microsoft Technical Support
Explains how to access technical support.

© 1991-1997 Microsoft Corporation


Legal Information

Information in this document is subject to change without notice. The names of companies, products, people, characters, and/or data mentioned herein are fictitious and are in no way intended to represent any real individual, company, product or event, unless otherwise noted. Complying with all applicable copyright laws is the responsibility of the user. No part of this document may be reproduced or transmitted in any form or by any means, electronic or mechanical, for any purpose, without the express written permission of Microsoft Corporation. If, however, your only means of access is electronic, permission to print one copy is hereby granted.

Microsoft may have patents, patent applications, trademarks, copyrights, or other intellectual property rights covering subject matter in this document. Except as expressly provided in any written license agreement from Microsoft, the furnishing of this document does not give you any license to these patents, trademarks, copyrights, or other intellectual property.

© 1997 Microsoft Corporation. All rights reserved.

Microsoft, Microsoft Press, MS, MS-DOS, Visual Basic, Visual C++, Windows, Win32, Win32s, Windows NT, OS/2, Visual SourceSafe and Visual Studio are either registered trademarks or trademarks of Microsoft Corporation in the U.S.A. and/or other countries.

Other product and company names mentioned herein may be the trademarks of their respective owners.


Welcome to the Windows CE Toolkit for Visual Basic 5.0

The Microsoft® Windows® CE Toolkit for Visual Basic® 5.0 enables you to develop Windows CE applications in the same integrated development environment (IDE) you use to develop other Microsoft® Visual Basic® applications. This book provides you with all the information you need to create world class Windows CE applications, including a complete language reference of all of the properties, methods, and events Windows CE supports. The following four documents are provided with this toolkit.

( [image] ) Getting Started Guide

This guide explains how to use the Windows CE Toolkit for Visual Basic 5.0. It contains information to get you up and running, developing applications, as quickly as possible. Topics in this guide include:

Hardware and System Requirements

Installing the Windows CE Toolkit for Visual Basic 5.0

Supported Features

The Development Model

Starting a Project

Setting Project Properties

Exploring the Windows CE Toolkit for Visual Basic 5.0 IDE

Using the Remote Tools

Installing Controls Using the Windows CE Control Manager

Adding Controls to a Form

Building a Project

Running an Application

Downloading Runtime Files

Debugging Code and Handling Errors

Creating an Installation Program

Uninstalling the Windows CE Toolkit for Visual Basic 5.0

( [image]) Programming Guide

This guide provides detailed information about each of the Windows CE Remote Tools. It also provides information on the Windows CE Toolkit for Visual Basic 5.0 debugging environment. Topics in this guide include:

Exploring the Debugging Environment

Windows CE Application Install Wizard

Windows CE Control Manager

Windows CE Spy

Windows CE Registry Editor

Windows CE Zoom

Windows CE Process Viewer

Windows CE Heap Walker

( [image]) Windows CE Toolkit for Visual Basic 5.0 Help

This guide provides a complete reference for Visual Basic features supported in Windows CE. It includes sections on the programming language, controls, and other references. Topics in this guide include:

Language Reference

( [image]) Microsoft Technical Support

This guide explains how to access technical support. Topics in this guide include:

Your Guide to Microsoft Technical Support

Self-Help Tools

Direct Assistance with a Microsoft Technical Support Engineer

Microsoft Technical Support Worldwide

The documentation provided in this toolkit is intended for intermediate and advanced Visual Basic programmers who are familiar with Visual Basic programming concepts and interested in using Visual Basic to develop Windows CE applications.


Introduction

This section provides an overview of the tasks you can accomplish using the Microsoft® Windows® CE Toolkit for Visual Basic® 5.0.

The following topics assume that you are familiar with Microsoft® Visual Basic® 5.0 and know how to use the integrated development environment (IDE). The following topics describe procedures specific to Windows® CE development. Help for Visual Basic 5.0 is available from the Visual Basic Books Online.

  • Hardware and System Requirements
  • Installing the Windows CE Toolkit for Visual Basic 5.0
  • Supported Features
  • The Development Model
  • Starting a Project
  • Setting Project Properties
  • Exploring the Windows CE Toolkit for Visual Basic 5.0 IDE
  • Using the Remote Tools
  • Installing Controls Using the Windows CE Control Manager
  • Adding Controls to a Form
  • Building a Project
  • Running an Application
  • Downloading Runtime Files
  • Debugging Code and Handling Errors
  • Creating an Installation Program
  • Uninstalling the Windows CE Toolkit for Visual Basic 5.0


Hardware and System Requirements

In order to run the Windows CE Toolkit for Visual Basic 5.0 on a remote device, you need the following items.

  • PC with a 486/66 MHz or higher processor; Pentium or higher processor recommended.
  • Microsoft Windows NT® Workstation operating system version 4.0.
  • Microsoft Visual Basic, Professional or Enterprise edition, version 5.0.
  • 24 MB of RAM; 32 MB recommended.
  • Hard-disk space required:
    • Minimum installation: 50 MB.
    • Complete installation: 80 MB
  • CD-ROM drive.
  • VGA or higher-resolution monitor; Super VGA recommended.
  • Microsoft Mouse or compatible pointing device.

Note You need Windows NT to run emulation, since Windows CE is Unicode only and NT provides the necessary Unicode environment.

If you need to install Internet Explorer when you bring up Windows CE Books Online, you can install it by running the msie302.exe in the /msie302 directory.


Installing the Windows CE Toolkit for Visual Basic 5.0

The Windows CE Toolkit for Visual Basic 5.0 is an add-on that can only be installed after the installation of Visual Basic 5.0.

To install Windows CE Toolkit for Visual Basic 5.0

  1. Verify that Visual Basic 5.0 is already installed on your system.
  2. Run the Setup.exe program for the Windows CE Toolkit for Visual Basic 5.0. It will be installed in a subfolder, named vbce, located within the folder for Visual Basic 5.0. See the readme file for any additional information.

When you run the installation program for the Windows CE Toolkit for Visual Basic 5.0, the Windows CE Platform SDK, including the emulation environment, will also be installed.

Setup will also ask if you wish to install Windows CE Services. Choose Yes, if CE Services is not already installed on your system. This will allow you to connect to a remote device.


Supported Features

The language chosen for the Windows CE Toolkit for Visual Basic 5.0 is a subset of Visual Basic 5.0. This section lists the language features supported in the Windows CE Toolkit for Visual Basic 5.0. For information on how features supported in this toolkit differ from those supported in Visual Basic, see the following topics.

  • What's Handled Differently in Windows CE
  • What Does Visual Basic 5.0 Have that Windows CE Doesn't
  • What Does Windows CE Have that Visual Basic 5.0 Doesn't
  • What Controls, Properties, Events, and Methods are Unsupported
Category | Keyword
Array handling | Array Dim, Private, Public, ReDim IsArray Erase LBound, UBound
Assignments | Set
Comments | Comments using ' or Rem
Constants/Literals | Empty Nothing Null True, False
Control flow | Do...Loop For...Next For Each...Next If...Then...Else Select Case While...Wend
Conversions | Abs Asc, AscB, AscW Chr, ChrB, ChrW CBool, CByte CCur, CDate CDbl, CInt CLng, CSng, CStr DateSerial, DateValue Hex, Oct Fix, Int Sgn TimeSerial, TimeValue
Dates/Times | Date, Time DateAdd, DateDiff, DatePart DateSerial, DateValue Day, Month, MonthName Weekday, WeekdayName, Year Hour, Minute, Second Now TimeSerial, TimeValue
Declarations | Const Dim, Private, Public, ReDim Function, Sub
Formatting Strings | FormatCurrency FormatDateTime FormatNumber FormatPercent
Error Handling | On Error Err
Input/Output | InputBox MsgBox
Literals | Empty False Nothing Null True
Math | Atn, Cos, Sin, Tan Exp, Log, Sqr Randomize, Rnd
Miscellaneous | RGB Function
Objects | CreateObject
Operators | Addition (+), Subtraction (-) Exponentiation (^) Modulus arithmetic (Mod) Multiplication (*), Division (/), Integer Division (\) Negation (-) String concatenation (&) Equality (=), Inequality (<>) Less Than (<), Less Than or Equal To (<=) Greater Than (>), Greater Than or Equal To (>=) Is And, Or, Xor Eqv, Imp
Options | Option Explicit
Procedures | Call Function, Sub
Rounding | Abs Int, Fix, Round Sgn
Strings | Asc, AscB, AscW Chr, ChrB, ChrW Filter, InStr, InStrB InStrRev Join Len, LenB LCase, UCase Left, LeftB Mid, MidB Right, RightB Replace Space Split StrComp String StrReverse LTrim, RTrim, Trim
Variants | IsArray IsDate IsEmpty IsNull IsNumeric IsObject TypeName VarType


What's Handled Differently in Windows CE

The Windows CE Toolkit for Visual Basic 5.0 is similar to Visual basic 5.0 in both functionality and design. However, several Visual Basic features have not been implemented because of limitations in the Windows CE operating system. These limitations impose the following restrictions:

  • Visual Basic class files are not supported.
  • Only one .bas file is supported.
  • No support for ActiveX controls written in Visual Basic 5.0.
  • Help is not supported.
  • Language errors are displayed only at run time.
  • Designers and insertable objects, such as Excel, are not supported.
  • The Auto Increment checkbox on the Make tab is not supported.
  • Arrays may not get initialized when there is little free memory.
  • The Debug object is not supported.
  • The standard toolbar cannot be customized.
  • Duplicate sub or functions, such as a sub-sub, function-function, or sub-function combination, are not supported.
  • Adding an existing Visual Basic 5.0 code module or existing Visual Basic 5.0 forms, including those listed in the "Add Form" dialog, to a Windows CE Toolkit for Visual Basic 5.0 project is generally not supported because the code module or form may use controls and/or language syntax not supported by Windows CE Toolkit for Visual Basic 5.0 .


What Does Visual Basic 5.0 Have that Windows CE Doesn't

The following language features are available in Visual Basic 5.0, but are not available in Windows CE Toolkit for Visual Basic 5.0.

Category | Omitted Feature/Keyword | Notes
Array Handling | Option Base Declaring arrays with lower bound <> 0 |
Collection | Add, Count, Item, Remove Access to collections using ! character (e.g., MyCollection!Foo) |
Conditional Compilation | #Const #If...Then...#Else | Most uses of the # character, including File access using #filenum (#date# is okay):
Control Flow | DoEvents GoSub...Return, GoTo On Error GoTo On...GoSub, On...GoTo Line numbers, Line labels With...End With End, Stop | Use App.End to end your program. On Error Resume Next is provided for error handling.
Conversion | CVar, CVDate Str, Val |
Data Types | All intrinsic data types except Variant Type...End Type AS |
Date/Time | Date statement, Time statement Timer |
DDE | LinkExecute, LinkPoke, LinkRequest, LinkSend |
Debugging | Debug.Assert, Debug.Print End, Stop |
Declaration | Declare (for declaring DLLs) New Optional ParamArray Property Get, Property Let, Property Set Static |
Error Handling | Erl Error On Error...Resume Resume, Resume Next |
File Input/Output | All traditional Basic file I/O | Use Windows CE ActiveX controls for file I/O
Financial | All financial functions | Use Windows CE ActiveX controls for financial functions
Object Manipulation | TypeOf |
Operators | Like |
Options | Deftype Option Base Option Compare Option Private Module |
Select Case | Expressions containing Is keyword or any comparison operators Expressions containing a range of values using the To keyword. |
Strings | Fixed-length strings LSet, RSet Mid Statement StrConv |
Using Objects | Collection access using ! |
Statements with a $ Character | Chr$, Command$, Date$, Environ$, Error$, Format$, InputBox$, Lcase$, Left$, Ltrim$, Mid$, Right$, Rtrim$, Space$, Str$, String$, Time$, Trim$, Ucase$ |


What Does Windows CE Have that Visual Basic 5.0 Doesn't

The following language features are available in Windows CE Toolkit for Visual Basic 5.0, but are not available in Visual Basic 5.0.

Category | Omitted Feature/Keyword
Formatting strings | FormatCurrency FormatDateTime FormatNumber FormatPercent MonthName WeekdayName Round Filter InstrRev Join Replace Split StrReverse FormatDateTime FormatNumber FormatPercent MonthName WeekdayName
Intrinsic constants | vbGeneralDate vbLongDate vbLongTime vbShortDate vbLongDate vbTristateFalse vbTristateMixed vbTristateTrue vbTristateUseDefault
Objects | All objects. Windows CE Toolkit for Visual Basic 5.0 has its own objects.
Rounding | Round
Strings | Filter InstrRev Join Replace Split StrReverse


What Controls, Properties, Events, and Methods are Unsupported

The following intrinsic controls located in the Toolbox are not supported by the Windows CE Toolkit for Visual Basic 5.0.

  • Directory List Box
  • Drive List Box
  • File List Box
  • Image
  • Picture Box
  • Data
  • OLE

Note If you select a control that is not supported in Windows CE, an error message will be displayed.

The following table summarizes unsupported properties, methods, and events in Windows CE Toolkit for Visual Basic 5.0.

Properties | Methods | Events
DataChanged | Drag | DragDrop
DataField | GetData | DragOver
DataSource | OLEDrag | Get Focus*
DisabledPicture | PopupMenu | KeyDown, KeyUp*
DownPicture | SetData | KeyPress*
DragIcon | ShowWhatsThis | LinkClose
DragMode | WhatsThisMode | LinkError
Enabled* |  | LinkNotify
HelpContextID |  | LinkEvent
Index |  | Lost Focus*
LastDLLError |  | LogEvent
LinkItem |  | MouseDown, MouseUp*
LinkMode |  | MouseMove*
LinkTimeout |  | OLECompleteDrag
LinkTopic |  | OLEDragDrop
MaxButton |  | OLEDragOver
MinButton |  | OLEGiveFeedBack
MouseIcon |  | OLESetData
MousePointer |  | OLEStartDrag
OLEDrag |  | StartLogging
OLEDragMode |  |
OLEDropMode |  |
Picture |  |
RightToLeft |  |
SelText (ActiveX) |  |
Tag* |  |
ToolTipText |  |
WhatsThisHelp |  |
WhatsThisHelpID |  |

* These properties and events are not supported for the Tabstrip, ListView, and TreeView controls.


The Development Model

The following table presents an overview of the development model to use when building applications with Windows CE Toolkit for Visual Basic 5.0.

Stage | Process
Get Started | You do not need a remote device to begin developing Windows CE applications. Start Microsoft Visual Basic 5.0 and choose Windows CE as the project type.
Set the Project Properties | Specify your project information in the Project Properties box. Choose whether to develop for the emulator or for a remote device. Choose whether or not to run the program in the debugger.
Write your Program | Position the form, add the controls you want, and write code for the events that will be generated by those controls.
Debug or Run in Emulation | Use the debugger to test your project in the emulation environment during the initial stages of development.
Debug or Run on the Remote Device | Use the remote debugging tools to debug from your desktop as the program runs on the device.
Create an Installation Program | Use the Application Install Wizard to create an installation program.


Starting a Project

When starting a new project, you must specify which environment you are developing for; whether emulation or a remote device. When you first start your project, develop for emulation, where you can quickly debug your program and evaluate its interface. When you are ready to run and test your program on the device, reconfigure the project properties to build for a remote device.

To write a Windows CE Toolkit for Visual Basic 5.0 program:

  1. Start Visual Basic 5.0.
  2. Visual Basic displays the following New Project dialog box, which shows all types of programming projects.

  3. Select and double-click on the new project type, Windows CE Project.

    When you start a Windows CE project, the Visual Basic IDE changes slightly and determines the types of objects and components your program can use. Control components are limited when you are creating a Windows CE project due to memory constraints and other factors. The Project Properties dialog appears.

  4. Set properties, choose emulator, or remote device.
  5. Write your code.
  6. Connect the remote device, if necessary.
  7. Run or debug the program for emulation or the remote device.

To start the emulator

The emulator is started automatically when you run a program for emulation. You can start the emulator manually when you are not running a Visual Basic program.

  1. Click the Start button, point to Programs, and then click Windows CE Platform SDK.
  2. Select Desktop HPC Emulation.

To start the remote device

  • Connect the device to your PC.

    Windows CE Services will attempt to establish a connection to your remote device. When you are connected, Windows CE Toolkit for Visual Basic can automatically determine your processor type and download the correct files to your H/PC when you run a program or use the remote tools.

    Windows CE Services installs an icon named "Mobile Devices" on your desktop from which you can also initiate a connection to the remote device.

Note Before you start a Windows CE Toolkit for Visual Basic 5.0 program, you first need to run Visual Basic 5.0 (since Windows CE Toolkit is an add-on product to Visual Basic 5.0).

To start a new Windows CE emulation project

  1. On the File menu, click New Project.
  2. Double-click the "Windows CE Project" in the New Project dialog box.
  3. In the Run on Target frame box, select Emulator.

To start a new Windows CE remote device project

  1. On the File menu, click New Project.
  2. In the New Project dialog box, double-click Windows CE project.
  3. In the Run on Target box, select Remote Device.


Setting Project Properties

When you start a new Windows CE project, the following Project Properties dialog box is displayed. Change project properties by selecting the Project Properties command on the Project menu. In the Project Properties dialog box, you can name your project, set the default form size, and set the local and remote paths for storing your compiled programs. You may also specify extra information about your project that can be accessed at run time via the App object.

The General Tab

Use the General Tab to set the following properties:

Project Name

Specifies the name of your application to Visual Basic. It will be used in the Project Menu and in the Project Window to name your project. It will also serve as the default file name when you save your project.

Form Width, Form Height

Sets the default width and height of new forms, in pixels,. The Properties window will show these values in twips — a device-independent unit of measurement used by Visual Basic for calculating display size and position. This setting is used only when adding a new form to your project. To resize a form, change the Height and Width in the form's Properties window or drag the form's resizing handles.

Local Path

Specifies the path and file name for storing the compiled program. When the program is executed, Windows CE Toolkit for Visual Basic 5.0 creates a Visual Basic executable (.pvb) file in the location specified here.

Remote Path

Specifies the path and file name for storing the program on the remote device. When the program is executed, Windows CE Toolkit for Visual Basic 5.0 creates a Visual Basic (.pvb ) file to the location specified here.

Project Description

Sets the descriptive text that is displayed in the Description panel at the bottom of the Object Browser.

Help File Name

Displays the name of the Help file associated with the project.

Startup Object

Specifies the form to run first. This field may also be set to Sub Main if a procedure named Main exists in your program's BAS module.

Run on Target

Lets you select whether the application will be run on either the emulator or on the remote device when you start your program from the Visual Basic IDE. This setting does not affect how the program is compiled.

The Make Tab

The Make Tab enables you to specify version and application information.

The Make Tab properties include:

Version Number

Creates the version number for the project.

Application Title

Lets you identify a name for the project.

Build Debug

When this box is checked, the Windows CE Toolkit for Visual Basic 5.0 Debugger is started when you run your program from the Visual Basic IDE.

Version Information

These settings correspond to properties of the App object and allow you to provide specific information about the current version of your project.

Information | Description
Type | The name of the property you want to set. You can enter information for your company name, file description, legal copyright, legal trademarks, product name, and comments.
Value | The value for the property selected in the Type box.


Exploring the Windows CE Toolkit for Visual Basic 5.0 IDE

The working environment in Windows CE Toolkit for Visual Basic 5.0 is often referred to as the integrated development environment or IDE because it integrates many different functions such as design, editing, and compiling within a common environment.

When you first start the toolkit, you see the interface of the integrated development environment:

It consists of the following elements.

Menu Bar

Displays the commands you use to work with in Windows CE. Besides the standard File, Edit, View, Window, and Help menus, menus are provided to access functions specific to programming such as Project, Format, Run, and Debug. Additionally, the toolkit includes the Windows CE menu that contain specific Windows CE commands such as the Windows CE Control Manager and Windows CE Spy.

Because of certain limitations in the Windows CE operating system, some menu commands present in the Visual Basic IDE are not present in Windows CE. For example, commands typically used to debug an application have been removed because Windows CE comes with a separate debugger. For more information on Visual Basic features not supported in Windows CE, see What's Handled Differently in Windows CE.

Context Menus

Contain shortcuts to frequently performed actions. To open a context menu, click the right mouse button on the object you're using. The specific list of shortcuts available from context menus depends on the part of the environment where you click the right mouse button. For example, the context menu displayed when you right click on the Toolbox lets you display the Components dialog box, hide the Toolbox, and dock or undock the Toolbox, or add a custom tab to the Toolbox.

Toolbars

Provide quick access to commonly used commands in the programming environment. You click a button on the toolbar once to carry out the action represented by that button. By default, the Standard toolbar is displayed when you start the toolkit. Toolbars can be docked beneath the menu bar or can "float" if you select the vertical bar on the left edge and drag it away from the menu bar.

Toolbox

Provides a set of tools that you use at design time to place controls on a form..

Project Explorer Window

Lists the forms and modules in your current project. A project is the collection of files you use to build an application.

Properties Window

Lists the property settings for the selected form or control. A property is a characteristic of an object, such as size, caption, or color.

Object Browser

Lists objects available for use in your project and gives you a quick way to navigate through your code. You can use the Object Browser to explore objects in Visual Basic and other applications, see what methods and properties are available for those objects, and paste code procedures into your application.

Form Designer

Serves as a window that you customize to design the interface of your application. You add controls, graphics, and pictures to a form to create the look you want. Each form in your application has its own form designer window.

Code Editor Window

Serves as an editor for entering application code. A separate code editor window is created for each form or code module in your application.

Form Layout Window

The Form Layout window allows you to position the forms in your application using a small graphical representation of the screen.


Using the Remote Tools

After you install the Microsoft® Windows® CE Toolkit for Visual Basic® 5.0, you will be able to use several new tools. If you are using this toolkit, its tools will appear on the Visual Basic submenu. These tools enhance the functionality of your development environment by enabling you to access a remote device from a desktop computer and perform a variety of Windows CE-specific tasks.

The Windows CE Toolkit for Visual Basic 5.0 includes eight tools. Choose any of these items to start a Windows CE remote tool from within the Visual Basic Environment.

To run a remote tool

  1. From the Visual Basic 5.0 main menu, select Windows CE.
  2. Select a tool from the list.

    – Or –

  3. Click the Start button, select Programs, then Visual Basic 5.0, and then choose Windows CE.
  4. Select a tool from the list.

The table below provides a brief description of each of the Windows CE remote tools.

Windows CE Tool | Description
Windows CE Application Install Wizard | Creates an installation program for your application.
Downloading Runtime Files | Downloads runtime files to the device or for emulation.
Windows CE Control Manager | Registers and installs a control.
Windows CE Heap Walker | Enables you to view detailed information about heap identifiers and flags for processes that are running on the remote device. It is also useful to determine if an application has memory leaks.
Windows CE Process Viewer | Displays a graphical view, on the desktop computer, of Windows CE process and thread characteristics. The Process Viewer enables you to view memory usage and search for memory leaks.
Windows CE Registry Editor | Manages remote device registry entries from the desktop computer.
Windows CE Spy | Displays a graphical view, on the desktop computer, of Windows CE system processes, threads, windows, and window messages running on the remote device.
Windows CE Zoom | Captures an image from the remote device and displays it on the desktop computer.
Remote Object Viewer | A tool provided with the Windows CE SDK that enables you to move desktop files between the emulator and your device.

When running multiple instances of the Windows CE tools, note the following general rules:

  • You can run multiple instances of Windows CE Zoom.
  • You can only run a single instance of Windows CE Spy, Windows CE Registry Editor, Windows CE Process Viewer, Windows CE Heap Walker, and Remote Object Viewer.

Note The Windows CE Registry Editor and the Remote Object Viewer are the only tools that supported in emulation.


Installing Controls Using the Windows CE Control Manager

Several new controls are included with the Windows CE Toolkit for Visual Basic 5.0. These controls must be installed for emulation or for use on the remote device by using the Control Manager. When you start the Windows CE Control Manager utility, the Control Manager downloads a list of installed controls. When a control is available for use on an Visual Basic form, it is shown in the Toolbox. To add an installed control to the Toolbox, click Project on the Visual Basic menu and choose Components, then check the box next to the name of the component you wish to add. When you are finished, update your system to synchronize, so that both the emulation and the device have the latest updated controls. Controls from third-party vendors should be installed according to the instructions provided with the control. For step-by-step instructions on installing a control, see the following topics:

  • Starting Windows CE Control Manager
  • Installing Controls for Emulation
  • Installing Controls for a Device
  • Synchronizing Controls
  • Adding and Removing Existing Controls


Adding Controls to a Form

A control helps you create objects on a form, such as labels, buttons, and lists. You can give the object different property values, create events, and perform certain actions using methods.

The Windows CE Toolkit for Visual Basic 5.0 contains several controls. The intrinsic controls are displayed in the Toolbox.

To add a control

  1. Start a new Windows CE project by starting Visual Basic 5.0, then clicking the Windows CE Project icon in the New Project dialog box.
  2. Click on a control in the Toolbox, and then move the mouse pointer to a location on the form where the control's top, left corner is to be placed.
  3. Hold the left mouse button down and move the mouse pointer down and to the right until the control is the size you desire.
  4. Release the left mouse button.

To resize a control

  1. Single-click the control on the form to give it focus.
  2. Select a resizing handle.
  3. Hold the left mouse button down and move the mouse to change the size of the control.
  4. Release the left mouse button.

To add a third-party control

  • Use the Windows CE Control Manager to download and register a control.


Building a Project

When you build a Windows CE project, the toolkit compiles your code and creates a Visual Basic (.pvb) file in the location specified in the Local Path box of the Project Properties dialog.

To build a project

  • Choose the Make Project button on the toolbar.

    – Or –

  • Choose Press F5, to run the application.

    – Or –

  • On the Main menu, choose Run.

    – Or –

  • On the File menu, choose Make Project1 (where project1 is the name of your project).

Note The Make Project menu item on the File menu builds the .pvb file in the location pointed to in the Project Properties dialog box.

Windows CE Toolkit for Visual Basic 5.0 does not check errors during design. Instead, an error message will be displayed when you run your application.


Running an Application

When you run an application from the Windows CE Toolkit for Visual Basic 5.0 IDE, it is compiled to create a .pvb file. The .pvb file containing your code is copied to the Remote Path specified in Project Properties. If "Emulator" is the selected setting for Run on Target, then the emulator starts automatically. Otherwise, if a remote device is connected, the toolkit determines your processor type. If the runtime files have not been already been downloaded, they are downloaded automatically. The toolkit then starts pvb.exe, which, in turn, executes the code in the .pvb file to run your program.

If you have included any extra controls in your project, they must be installed on the device specified in the Run on Target box in Project Properties. You can use the Windows CE Control Manager to verify that the correct controls are installed on your target device.

Note If your Windows CE Toolkit for Visual Basic 5.0 program hangs during execution, you can terminate the program by terminating the associated pvb.exe file. Each Windows CE project uses a separate instance of pvb.exe.

To run your program under emulation

  1. In the Project Properties dialog box, set the Run on Target to Emulation.
  2. Press the F5 key.

    – Or –

    On the Run menu, select Start.

To run your program on a remote device

  1. Set the Run on Target to Remote Device in the Project Properties dialog box.
  2. Press the F5 key.

    – Or –

    On the Run menu, select Start.


Downloading Runtime Files

When running a project in emulation or on a device, the runtime files are automatically downloaded.

The following files will be downloaded to the connection:

  • pvb.exe
  • pdm.dll
  • vbscript.dll
  • vbsen.dll
  • pvbrt.dll
  • regsvr.exe
  • vbrmon.dll

To download runtime files to a device

  1. Make sure your PC is connected to the device before you download the runtime files.
  2. Make sure your target is Remote Device in Project Properties.
  3. On the Windows CE menu, choose Download Runtime Files.

To download runtime files to the emulator

  1. Make sure your target is Emulator in Project Properties.
  2. On the Windows CE menu, choose Download Runtime Files. The emulator will be automatically opened and the runtime files will be downloaded to the emulator.


Debugging Code and Handling Errors

No matter how carefully you write your code, errors can and probably will occur. Incorrect syntax can result in a compile-time error. An unexpected action by the user can result in a run-time error. Whatever the cause, this toolkit will assist you in identifying and handling application errors . During compile-time, the toolkit notifies you of all declaration and syntax errors present in your code. During run-time however, you can use the following three tools to handle errors:

  • The Err object
  • The On Error Resume Next statement
  • The Windows CE Toolkit for Visual Basic 5.0 Debugger

For a listing of compile-time errors that can occur in your application, see Compile-Time Errors.


Handling Errors with the Err Object

The Err object is used to intercept errors and take corrective action. When an error occurs, the toolkit sets the Err.Description, Err.Number, and Err.Source properties of the Err object. You can create an error-handling routine that uses the Err object properties to identify the problem and respond intelligently to the error situation.

Most runtime errors in Windows CE produce the following generic Application Error dialog box. No other information about what may have caused the error is provided to the user.

Another Application Error dialog box displayed by Windows CE, occurs while the user is on a Startup Form. If a program attempts to use an ActiveX control that has not been properly registered, or is not present on the device, a generic Application Error message is generated and the Err object reflects error 429. To resolve this type of error, reinstall the Windows CE application that includes the control or use Control Manager to download the control to the device.

For more information on error handling, see Debugging Your Code and Handling Errors your Visual Basic 5.0 Books Online documentation.


Handling Errors with the On Error Resume Next Statement

The On Error Resume Next statement is useful when performing inline error handling. This statement is the only error handling statement the toolkit supports. On Error Resume Next does not clear the Err object, so you can use inline error handling to display a meaningful error messages rather than displaying the generic Application Error message.

The following is an example of an inline error handling routine:

Private Sub Command1_Click()
   On Error Resume Next
   Dim N, D
   N = InputBox("Please enter a number to divide by:", "FractionMaker")
   D = 1 / N
   If Err = 0 Then
      MsgBox 1 / N, vbOKOnly, "1 / " & N
   Else
      MsgBox Err.Description, vbExclamation, "Error: " & Err
   End If
End Sub

The following are possible errors you could handle using this routine:

  • 06: Overflow – enter 1E+999 to get this error
  • 11: Divide By Zero – enter 0
  • 13: Type Mismatch

You could handle each error separately based on the Err.Number property.

For more information on error handling, see Debugging Your Code and Handling Errors your Visual Basic 5.0 Books Online documentation.


Using the Windows CE Toolkit for Visual Basic 5.0 Debugger

The Microsoft Windows CE Toolkit for Visual Basic 5.0 comes with a separate program you can use to debug your Windows CE applications. This program runs outside of the Visual Basic IDE, so the debugging options available in the Visual Basic IDE are not supported in the toolkit. Instead, the toolkit checks your code for syntax errors, then consolidates the code and property values into a .PVB file for transport to the emulation environment or remote device. Your application is completely compiled before it reaches the debugger, so you cannot edit code in the debugger's code window. Because all errors, other than syntax errors, are caught at run-time, applications must be running in either the emulated or remote Windows CE environment before you can begin the debugging process. Though most debugging is done while in emulation mode, you should also debug your application on the remote device in order to ensure your application is error free.

To debug your application, use the following procedure.

  1. Start the debugger.
  2. Set breakpoints.
  3. Trace through your code using the Step commands.
  4. Analyze objects and variables using the Watch and Immediate windows.
  5. Test your code in the Immediate Window.
  6. Exit the debugger.
  7. Modify your application.
  8. Recompile your application.

For specific information on using the debugger to complete these and other tasks, see Exploring the Debugging Environment.


Creating an Installation Program

Use the Windows CE Application Install Wizard to create an installation program for your application. The Install Wizard creates a setup program (setup.exe), a directory containing a readme file, and several other files and directories.

To run the Windows CE Application Install Wizard

  • From the Windows CE menu, select Application Install Wizard.

To create an installation program for your Windows CE application

  • The Application Install Wizard leads you through the process to create an installation program. For step-by-step instructions on using the Application Wizard, see Walking Through the Application Wizard.

Note Using Notepad, you can customize the installation program by adding or changing code in the .INF file.

For more information about CAB wizard and .INF files, refer to the Microsoft Windows CE SDK Programmer's Guide.


Uninstalling the Windows CE Toolkit for Visual Basic 5.0

If you need to restore the original Visual Basic installation, you can uninstall the Toolkit.

To uninstall Windows CE Platform SDK

Before you uninstall, make sure you do not have other applications open, such as Windows CE Toolkit for Visual C++, that are dependent on the Windows CE Platform SDK.

  1. On the Install/Uninstall tab of Add/Remove Programs, select Windows CE Platform SDK.
  2. Click Add/Remove, and follow the on-screen instructions.

To uninstall Windows CE Toolkit for Visual Basic 5.0

  1. On the Install/Uninstall tab of Add/Remove Programs, select Windows CE Toolkit for Visual Basic 5.0.
  2. Click Add/Remove, and follow the on-screen instructions.

To uninstall Windows CE Services

  1. On the Install/Uninstall tab of Add/Remove Programs, select Windows CE Services.
  2. Click Add/Remove, and follow the on-screen instructions.


Exploring the Debugging Environment

The Microsoft® Windows® CE Toolkit for Visual Basic® 5.0 debugger is designed specifically for Windows CE projects. Though it cannot diagnose or fix errors for you, it does help you analyze how execution flows from one part of a program to another, and how variables and property settings change as statements are executed. It lets you look inside your application to help you determine what happens and why.

The Windows CE debugger runs as a separate program outside of the Visual Basic IDE. It supports breakpoints, watch expressions, stepping through code one statement or one procedure at a time, and displaying the values of variables and properties.

To start the debugger

  1. Make sure the project is set to run in emulation, and that Build Debug is checked on the Make tab of Project Properties.
  2. On the Main menu, choose Debug, and then Step Into.

    – Or –

    On the Main menu, choose Run, and then choose Start.

    The debugger opens and following window appears:

To exit the debugger

  1. To exit the debugger
  2. On the Main menu, choose Debug, and then choose Exit.


Understanding Error Types

To understand how debugging is useful, consider the three kinds of errors you can encounter:

  • Compile errors
  • Run-time errors
  • Logic errors

Compile Errors

Compile errors result from incorrectly constructed code. If you incorrectly type a keyword, omit some necessary punctuation, or use a Next statement without a corresponding For statement at design time, Visual Basic detects these errors when you compile the application.

Compile errors include errors in syntax. For example, you could have a statement as follows:

Left$

Left is a valid word in the Visual Basic language, but whenyou add the invalid character $, it does not meet the syntax requirements for that word. If you have selected the Auto Syntax Check option in the Editor tab on the Options dialog box, Visual Basic will display an error message as soon as you enter a syntax error in the Code window. This option is on by default.

To set the Auto Syntax Check option

  1. From the Tools menu, select Options, and click the Editor tab on the Options dialog box.
    1. Select Auto Syntax Check.

For more information on compile errors, see Compile-Time Errors.

Run-Time Errors

Run-time errors occur while the application is running when a statement attempts an operation that is impossible to carry out. An example of this is division by zero. Suppose you have this statement:

Speed = Miles / Hours

If the variable Hours contains zero, the division is an invalid operation, even though the statement itself is syntactically correct. The application must run before it can detect this error.

Logic Errors

Logic errors occur when an application doesn't perform the way it was intended. An application can have syntactically valid code, run without performing any invalid operations, and yet produce incorrect results. Only by testing the application and analyzing results can you verify that the application is performing correctly.

How Debugging Tools Help

Debugging tools are designed to help you with:

  • Logic and run-time errors.
  • Observing the behavior of code that has no errors.

For instance, an incorrect result may be produced at the end of a long series of calculations. In debugging, the task is to determine what and where something went wrong. Perhaps you forgot to initialize a variable, chose the wrong operator, or used an incorrect formula.

There are no magic tricks to debugging, and there is no fixed sequence of steps that works every time. Basically, debugging helps you understand what's going on while your application runs. Debugging tools give you a snapshot of the current state of your application, including:

  • Appearance of the user interface (UI).
  • Values of variables, expressions, and properties.
  • Active procedure calls.

The better you understand how your application is working, the faster you can find bugs.


Using the Debugging Windows

Often you can find the cause of a problem by executing and analyzing portions of code. You might isolate a problem in a variable or property with an incorrect value, and then have to determine how and why that variable or property was assigned an incorrect value.

With the debugging windows, you can monitor the values of expressions and variables while stepping through the statements in your application.

There are four debugging windows used by the debugger: the Forms window, the Call Stack window, the Watch window and the Immediate window.

Window | Description
Forms Window | The Forms window displays code. You can select a form and the code will be displayed.
Call Stack Window | Lists the procedure calls that have started but are not yet completed.
Watch Window | Shows values for variable names.
Immediate Window | The Immediate window displays information that results from debugging statements in your code, or that you request by typing commands directly into the window.


Forms Window

The Forms window is used to display and debug Visual Basic runtime code, and can be used to view and debug the code in different forms. The Forms window consists of a code area and a margin which displays the code indicators.

To open a form window

  • Open a Forms window by double-clicking a form from the Visual Basic Forms window within the debugger.

Code Area

The Code area of the Forms window contains the code. The gray margin is the area where you can toggle the breakpoints and check the executable code.

Color Indicators

The gray margin displays the color indicators. The code is also colored.

The following color indicators appear while you are debugging your code:

Color | Description
Red code with a red dot | Indicates a breakpoint. You can set several breakpoints in the code.
Green (whole line) | Executable code with a breakpoint. The code executes up to this point.
Yellow arrow | Indicates current execution point in the code.

To set a breakpoint in your code

  1. Put the cursor in the gray margin area, or place the cursor on a line inside the Forms Window.
  2. Click the left mouse button in front of the code on the gray margin in front of the line at which you wish to set a breakpoint

    – Or –

  • Select the Toggle Breakpoint from the Debug menu

    – Or –

  • Select the Toggle Breakpoint icon on the Toolbar.

    – Or –

  3. Press the F9 key.
  4. The line of code will be red and a red dot will be displayed.

Note To set a breakpoint with code like the following: X=A: Y=B, in the Forms window, place the cursor on the second statement and press the F9 key.


Call Stack Window

The Call Stack window shows a list of all active procedure calls. Active procedure calls are the procedures in the application that were started but not completed.

The Call Stack window helps you trace the operation of an application as it executes a series of nested procedures. For example, an event procedure can call a second procedure, which can call a third procedure—all before the event procedure that started this chain is completed. Such nested procedure calls can be difficult to follow and can complicate the debugging process.

The Call Stack window is not available when the application is running. When executing code in a procedure, that procedure is added to a list of active procedure calls. Each time a procedure calls another procedure, the called procedure is added to the list. Called procedures are removed from the list when execution returns to the calling procedure.

The red color indicates the currently active procedure. Double-click a procedure down the Call Stack to see the place in code where the procedure above it was called.

Toolbar button


Watch Window

The Watch window is used to set values for variables.

You can use the Watch window to test your code and shows values of variables, or query or change the value of a variable while the code is running. When execution is stopped, set the variable to a new value as you would in code.

To display variable values

  1. Put the cursor on the first empty space in the Watch window.
  2. Enter the name of the variable.
  3. To see a value for this variable, you must pass the location in your code where your variable has some value.


Immediate Window

Sometimes when you are debugging or experimenting with an application, you may want to execute individual procedures or evaluate expressions. You can use the Immediate window to accomplish these tasks. You evaluate expressions by printing their values in the Immediate window. However, you cannot save code in the Immediate window.

In the Immediate window you can:

  • Type or paste a line of code and press ENTER to run it.

In break mode, a statement in the Immediate window is executed in the context or scope that is displayed in the Call Stack window. For example, if you type Print variable name, your output is the value of a local variable.


Using the Debug Toolbar

Visual Basic provides several buttons on the Debug toolbar that are very helpful.

The following table briefly describes each button's purpose.

Command | Button | Description
Go |  | Starts the debugger.
Toggle Breakpoint |  | Toggle a breakpoint on or off on the line of code where the cursor is located.
Step Into |  | Execute the current statement and break at the next line, even if it's in another procedure.
Step Over |  | Execute the entire procedure called by the current line and break at the line following the current line.
Step Out |  | Execute the remainder of the current procedure and break at the statement following the one that called the procedure.
Run to Cursor |  | Select a statement further down in your code where you want execution to stop.

Step Into

The Step Into button executes one statement at a time at the current execution point. (This is also known as single stepping.) After stepping through each statement, you can see its effect by looking at your application's forms or the debugging windows.If the statement is a call to a procedure, the next statement displayed is the first statement in the procedure.

If there is no current execution point, the Step Into command may appear to do nothing until you do something that triggers code.

To step through code one statement at a time

  1. On the Debug menu, choose Step Into.
  2. On the Debug toolbar, click the Step Into button.

    – Or –

  • Press F8

Step Over

The Step Over button is similar to the Step Into button, except that when the current statement contains a call to a procedure, it executes the procedure as a unit, and then steps to the next statement in the current procedure. Therefore, the next statement displayed is the next statement in the current procedure.

To step over code

  1. On the Debug menu, choose Step Over.
  2. On the Debug toolbar, click the Step Over button.

    – Or –

  • Press Alt + F10

Step Out

The Step Out button causes the debugger to execute the remaining lines of a procedure. The next statement displayed is the statement following the procedure call.

To step out of code

  1. On the Debug menu, choose Step Out.
  2. On the Debug toolbar, click the Step Out button.

    – Or –

  • Press Alt + F7

Run to Cursor

The Run to Cursor button is used to bypass steps in the code. You can select a statement further down the code by selecting a place where you want the execution to stop.

To bypass steps in the code

  1. Put your application in break mode.
  2. Place the cursor where you want to stop.
  3. Press CTRL+F7.

    – Or –

  • On the Debug menu, choose Run To Cursor.

Exit

Stops and closes the Debugger. The Debugger cannot be restarted until the program is stopped and restarted.


Using the View Menu

The View menu on the debugger displays the following commands:

  • Toolbar

    Displays the Toolbar.

  • Status Bar

    Displays the Status Bar.

  • Quick Watch

    Displays the Quick Watch dialog box with the current value of the selected expression.

    Use this command to check the current value of a variable, property, or other expression for which you have not defined a watch expression. Select the expression from either the Forms window or the Watch window, and then choose the Quick Watch command. To add a watch expression based on the expression in the Quick Watch dialog box, choose the Add button.


Windows CE Application Install Wizard

Use the Windows CE Application Install Wizard to create an installation program for your application. The Install Wizard creates an installation program (setup.exe), a directory containing a readme file, CAB and INF files.

For more information about CAB Wizard and .INF files, refer to Microsoft Windows CE SDK Programmer's Guide.

To run the Windows CE Application Install Wizard

  • On the Windows CE menu, select Application Install Wizard.

    The Application Install Wizard guides you through the steps necessary to create an installation program. For step-by-step instructions on completing the wizard, see Walking Through the Application Wizard.


Walking Through the Application Wizard

The Windows CE Application Install Wizard leads you through the steps necessary to create an installation program. There are eight steps you must complete.

To create an installation program

  1. Start the Application Wizard.
  2. Click Next to proceed to the Step 2 window.
  3. Type the name of the .PVB file for which you want to create an installation program. You must enter the full path in which the file is stored, including the drive name. The Toolkit saves your .PVB file in the location specified by the Local Path box on the Project Properties General Tab.
  4. Click Next to proceed to the Step 3 window.
  5. Enter the name of the directory where you want your output files created. You must include the drive name in your path.
  6. Click Next to proceed to the Step 4 window.
  7. Select the processors you would like to support. You must select at least one processor.
  8. Click Next to proceed to the Step 5 window.
  9. Select any additional ActiveX controls you want installed. If an ActiveX control is not supported for a processor you selected in the Step 4 window, it does not appear on the list.
  10. Click Next to proceed to the Step 6 window.
  11. Click the Add button to specify any additional data files you want to include with your program.

    Once you have selected a file, the wizard asks if the file selected is a sytem file. All system files are installed in the \windows directory. All other files are installed in your application's directory.

  12. Click Include Device Runtime in Cab file to install the following device runtime files:
    • pvb.exe
    • vbscript.dll
    • vbsen.dll
    • pvbrt.dll
    • regsvr.exe
  13. Click Next to proceed to the Step 7 window. The following screen appears:

  14. Enter your program's default directory, name, description, and your company name. Each textbox must contain data. The company name and application name are combined and used for filenames later in the setup process. They must be legal windows filenames. Example: MyCompany MyApplication
  15. Click Next to proceed to the Step 8 window.
  16. Click Create Install to create your program. A process indicator appear on the screen.
  17. Click Finish when the process indicator indicates that Create Install process is Finished.

Note Once the installation program is complete, you can customize your program by adding or changing code in the .INF file.

Uninstalling a .pvb application using Application Install Wizard

  1. Open the Mobile Devices window by clicking Start, Programs, Windows CE Services, Mobile Devices.
  2. On the Mobile Devices menu, select Tools, Application Manager. The Application Manager retrieves a list of installed programs from the device.
  3. Uncheck the box beside the application name inside the list box. The application name appears in the Description label box.
  4. Click the OK button. In a few moments, the application disappears from the Application Manager list box, as well as from the device.
  5. To close, click the OK button on the bottom of the Application Manager window.


Using the Windows CE Control Manager

Several new controls are included with the Windows CE Toolkit for Visual Basic 5.0. These controls must be installed for emulation or for use on the remote device by using the Control Manager. When you start the Windows CE Control Manager utility, the Control Manager downloads a list of installed controls. When a control is available for use on an Visual Basic form, it is shown in the Toolbox. To add an installed control to the Toolbox, click Project on the Visual Basic menu and choose Components, then check the box next to the name of the component you wish to add. Controls from third-party vendors should be installed according to the instructions provided with the control. For step-by-step instructions on installing a control, see the following topics:

  • Starting Windows CE Control Manager
  • Installing Controls for Emulation
  • Installing Controls for a Device
  • Synchronizing Controls
  • Adding and Removing Existing Controls


Starting Windows CE Control Manager

To start Windows CE Control Manager

  • In the Visual Basic IDE, select the Windows CE menu and click Control Manager

    – Or –

  • Click the Start button, point to Programs, click Visual Basic 5.0, click Windows CE, and then click Control Manager.

    – Or –

  • At the Windows NT command prompt, type "C:\Program Files\DevStudio\vb\vbce\cectlmgr.exe" and press Enter.


Installing Controls for Emulation

To install a new emulation control that is not listed in the control manager box

  1. On the Windows CE menu, click Control Manager.
  2. Click Emulation, and the click Install Controls. An Open dialog box displays the location of the controls.
  3. Find the directory where the controls reside. The default directory for the Windows CE controls is:
  4. \Program files\DevStudio\vb\vbce\bin\emulation\controls.
  5. Click on the control you want to install.

For example, to install the FileSystem control for emulation:

  1. Click Windows CE on the Visual basic menu and select Control Manager.
  2. Highlight FileSystem Class.
    1. Click Emulation and choose Install.
    2. When the control has been installed, close the Control Manager and return to Visual Basic.
    3. Click Project on the Visual Basic menu and select Components.
    4. Check the box next to the Microsoft CE File System Control 1.0 and click OK.

Two new icons will be installed in the Toolbox. In the emulator, a message box will show the control was successfully installed. Control Manager will have a "Yes" in the Desktop and Emulation columns for the control.


Installing Controls for a Device

To install a new device control not listed in the Control Manager box

  1. On the Windows CE menu, click Control Manager.
  2. Click on Device, and then click Install Controls. An Open dialog box displays the location of the controls.
  3. Find the directory where the controls reside. The default directory for the Windows CE controls is:
  4. \Program files\DevStudio\vb\vbce\bin\cpuname\controls.
  5. Click on the control you want to install.


Synchronizing Controls

To synchronize controls

  1. Select any of the controls shown by the Control Manager.
  2. On the Emulation menu, click Synchronize.


Adding and Removing Existing Controls

To install or uninstall a control listed in the control manager box

  1. Select the control in the box.
  2. Under Emulation or Device, select Install. The control will be installed

    – Or –

    Under Emulation or Device, select Uninstall. The control will be uninstalled.

Note This menu item is different from the Install Control menu item, which installs a new control from a selected directory .


Windows CE Spy

When you start the Windows CE Spy utility, the remote device downloads a Windows list to the desktop PC. The Windows list displays the windows that are open on the remote device. When you select a window and click Messages from the File menu, Windows CE Spy opens a secondary window that contains information about the messages in that window's message queue.

Use Windows CE Spy to:

  • Display a tree hierarchy that represents the relationships between system objects.
  • View messages that are being sent or posted to windows on the remote device.

The following topics are covered in this section:

  • Starting Windows CE Spy
  • Expanding or Collapsing the Windows CE Spy Tree


Starting Windows CE Spy

To start Windows CE Spy

  • In the Visual Basic IDE, select the Windows CE menu and then click Spy

    – Or –

  • Click the Start button, point to Programs, click Visual Basic 5.0, click Windows CE, and then click Spy.

    – Or –

  • At the Windows NT command prompt, type "C:\Program Files\DevStudio\vb\vbce\cespy.exe" and press Enter.

Use the Windows CE Spy toolbar to view messages for a selected window or to refresh the window list.

The Spy toolbar buttons are described in the following table.

Spy Toolbar Button | Description
Refresh window list | Refreshes the Windows CE Spy window list.
View messages | Display messages for a selected window.

Note You can run only a single instance of Windows CE Spy; if you try to run multiple instances, the current instance will be displayed. Windows CE Spy is a read-only utility that will not alter the functionality of any program, but it may slow system performance.


Expanding or Collapsing the Windows CE Spy Tree

To expand or collapse the Windows CE Spy tree

  • From the tree view, click the plus symbol (+) to the left of the window icon to expand the tree one level, or click the minus symbol (–) to collapse the tree one level.


Windows CE Registry Editor

The Windows CE system registry resides in the object store on the remote device. To edit the system registry, run the Windows CE Registry Editor. When you run the Registry Editor (ceregedt.exe), a dialog box opens and displays three top-level registry headings:

  • My Computer
  • My Emulation
  • My HPC

To inspect and modify the desktop computer system registry, double-click the My Computer registry heading.

To inspect and modify the emulation system registry, double-click the My Emulation registry heading.

To inspect and modify the remote device system registry, double-click the My HPC registry heading.

Each registry heading consists of the following top-level registry keys:

HKEY_LOCAL_MACHINE

The root key for configuration information.

HKEY_CLASSES_ROOT

The root key for associating a file with an application.

HKEY_CURRENT_USER

The root key for configuration information about the user currently logged on to the system.

The following topics are covered in this section:

  • Starting the Windows CE Registry Editor
  • Downloading Keys From the Remote Device
  • Exporting the Windows CE Registry to a Text File
  • Adding a Key
  • Adding a Value
  • Changing a Value
  • Deleting a Key or Value
  • Renaming a Key or Value


Starting the Windows CE Registry Editor

To start the Windows CE Registry Editor

  • In the Visual Basic IDE, select the Windows CE menu and click Registry Editor

    – Or –

  • Click the Start button, point to Programs, click Visual Basic 5.0, click Windows CE, and then click Registry Editor.

    – Or –

  • At the Windows NT command prompt, type "C:\Program Files\DevStudio\vb\vbce\ceregedit.exe" and press Enter.

When you start the Windows CE Registry Editor, the Windows CE Desktop Emulation Environment window appears in the upper-left corner of your monitor, then the Windows CE Registry Editor window appears.


Downloading Keys From the Remote Device

To have the Windows CE Registry Editor download the registry key from the remote device, double-click the My HPC registry heading, and then double-click any of the top-level registry keys.

When the remote registry key has finished downloading to your desktop computer, you can edit that registry key. When you edit the downloaded registry key, the user interface is using the Remote API to directly edit the registry of the remote device.


Exporting the Windows CE Registry to a Text File

To export the Windows CE registry to a text file

  1. On the Registry menu, click Export Registry File.
  2. In the Save in drop-down list box, select a file location.
  3. Enter a text string in the File name field.


Adding a Key

To add a key to the Windows CE registry

  1. Click New, and then click Key. The new key appears with a temporary name.
  2. Type a name for the new key, and then press Enter.


Adding a Value

To add a value to the Windows CE registry

  1. Click New, and then click the type of value you want to add: String Value, Multi-string Value, Binary Value, or DWORD Value. The new value appears with a temporary name.
  2. Type a name for the new value, and then press Enter.


Changing a Value

To change a Windows CE registry value

  1. Double-click the value you want to change to open the editing dialog box.
  2. In the Value data box, type the new data for the value.


Deleting a Key or Value

To delete a key or value from the Windows CE registry

  • Double-click the key or value you want to delete, click Edit, and then click Delete.


Renaming a Key or Value

To rename a key or value in the Windows CE registry

  1. Double-click on the key or value you want to rename, click Edit, and then click Rename. You do not have to open the key or value.
  2. Type the new name, and then press Enter.


Windows CE Zoom

Use the Windows CE Zoom utility (cezoom.exe) to capture and enlarge an area of the remote device desktop.

The following topics are covered in this section:

  • Starting Windows CE Zoom
  • Capturing a Remote Screen Image
  • Changing the Size of a Captured Remote Screen Image
  • Refreshing the Zoom Window
  • Copying the Contents of the Zoom Window to the Clipboard


Starting Windows CE Zoom

To start Windows CE Zoom

  • In the Visual Basic IDE, select the Windows CE menu and click Zoom.

    – Or –

  • Click the Start button, point to Programs, click Visual Basic 5.0, click Windows CE, and then click Zoom.

    – Or –

  • At the Windows NT command prompt, type "C:\Program Files\DevStudio\vb\vbce\cezoom.exe" and press Enter.

The Windows CE Zoom window appears, with a dialog box that contains a progress bar. This dialog box displays "Initializing communication with device" and then "Connecting to device" as your desktop computer and the remote device establish a communications link. The desktop computer then downloads a bitmapped screen capture from the remote device.


Capturing a Remote Screen Image

To capture a remote screen image

  • On the Windows CE Zoom Edit menu, click Copy Window.

    -Or-

  • On the Edit menu, click Copy All.


Changing the Size of a Captured Remote Screen Image

To change the size of a captured remote screen image

  • Use the Zoom In button to increase the size of a captured remote screen image. Each successive click enlarges the image.

  • Use the Zoom Out button to decrease the size of a captured remote screen image. Each successive click diminishes the image.


Refreshing the Zoom Window

To refresh the Zoom window

  • On the View menu, click Refresh.


Copying the Contents of the Zoom Window to the Clipboard

To copy the contents of the Zoom window to the clipboard

  • On the Edit menu, click Copy All to copy the entire contents of the Zoom window to the clipboard,

    -Or-

  • click Copy Window to copy the visible contents of the Zoom window to the clipboard.


Windows CE Process Viewer

The Windows CE Process Viewer (cepview.exe) lets you view detailed information about processes and threads running on the remote device. You can use the Windows CE Process Viewer to examine and modify many process and thread characteristics.

The following topics are covered in this section:

  • Starting the Windows CE Process Viewer
  • Refreshing the Windows CE Process Viewer


Starting the Windows CE Process Viewer

To start the Windows CE Process Viewer

  • In the Visual Basic IDE, select the Windows CE menu and click Process Viewer.

    – Or –

  • Click the Start button, point to Programs, click Visual Basic 5.0, click Windows CE, and then click Process Viewer.

    – Or –

  • At the Windows NT command prompt, type "C:\Program Files\DevStudio\vb\vbce\cepview.exe" and press Enter.

The Windows CE Process Viewer window displays a list of running Processes, Thread IDs, and Modules. Click a process to display the attributes for the selected process.

  • The Process list displays information about Process IDs, Base Priorities, the number of Threads running in each process, the Base Address of each process, the Access Key for each process, plus a list of all the Windows that belong to each process.
  • The Thread ID list displays information about thread IDs, current process IDs, thread priorities, and access keys.
  • The Module list displays information about module IDs, process counts, global counts, base addresses, base sizes, module handles, and the full path to the module.

Use the Windows CE Process Viewer toolbar to refresh the display of running processes or to terminate a selected process.

The Process Viewer toolbar buttons are described in the following table.

Process Viewer Toolbar Button | Description
Refresh process information | Refreshes the Windows CE Process Viewer window.
Terminate Process | Terminates the selected process.
Display Program Information | Displays the Windows CE Process Viewer About box.


Refreshing the Windows CE Process Viewer

To refresh the Windows CE Process Viewer

  • On the Process Viewer toolbar, click the Refresh Process Information button.

    -Or-

  • On the View menu, click Refresh.


Windows CE Heap Walker

The Windows CE Heap Walker (ceheapwk.exe) enables you to view detailed information about heap IDs and flags for processes that are running on the remote device. You can use the Windows CE Heap Walker to determine if an application is releasing all of the memory it is allocating. Windows CE Heap Walker is a useful tool to determine if an application has memory leaks.

The following topics are covered in this section:

  • Starting Windows CE Heap Walker
  • Saving Heap Walker Data in a Text File
  • Viewing the HeapList for a Selected Process
  • Viewing a Memory Dump for a ProcessID


Starting Windows CE Heap Walker

To start Windows CE Heap Walker

  • In the Visual Basic IDE, select the Windows CE menu and click Heap Walker.

    – Or –

  • Click the Start button, point to Programs, click Visual Basic 5.0, click Windows CE, and then click Heap Walker.

    – Or –

  • At the Windows NT command prompt, type "C:\Program Files\DevStudio\vb\vbce\ceheapwk.exe" and press Enter.

The Windows CE Heap Walker Process List column headings are described in the following table.

Column Heading | Description
Heap ID | A hex representation of a specific heap within the process space identified by the Process ID.
Process | A hex representation of a specific Process ID.
Process ID | A descriptive, user-readable text string.
Flag | The name of the flag associated with a specific heap. All processes start with at least one heap. HF32_DEFAULT refers to the default heap for the specified process.

Note Each process listed in the Process ID column can have more than one heap, so you may see multiple Heap ID listings for a single Process ID.

Each listing in the Heap ID column represents a specific heap in the process space, despite the fact that the same Heap ID may correspond to several different listings in the Process ID column.


Saving Heap Walker Data in a Text File

You can save the contents of the Memory Dump window, the Process list window, or the HeapList window in a text file.

To save the contents of a Windows CE Heap Walker window

  1. Select the window whose contents you want to save as a text file.
  2. On the File menu, click Save.


Viewing the HeapList for a Selected Process

To download and view the HeapList window for a selected process, double-click a Heap ID. The desktop computer then downloads a HeapList for the selected process.

The Windows CE Heap Walker HeapList column headings are described in the following table.

Column Heading | Description
Address | The address of the memory object.
Block Size | The size of the memory block, in bytes.
Flags | Fixed means the object is not movable or discardable; Free means the object is discardable. These refer to a block within a heap.


Viewing a Memory Dump for a ProcessID

To download and view the Memory Dump window for a selected processID, double-click a memory address within the heap.

Note You can display all of the Heap Walker windows by clicking Cascade or Tile on the Windows menu.

The Windows CE Heap Walker Process ID column headings are described in the following table.

Column Heading | Description
Address | The memory address of the heap.
Hex | A hex representation of the contents of the heap.
ASCII | An ASCII representation of the contents of the heap.


Compile-Time Errors

A variety of errors can occur during compilation of your Windows CE project. When one of these problems is detected, a dialog box with an appropriate message is displayed. This section provides information about the following types of errors you may encounter during compilation.

Type Declaration Errors

Miscellaneous Syntax Errors

PVB File Errors


Type Declaration Errors

In Windows CE all variables are of type Variant, which allows them to hold values of any type. It is an error to declare variables of a specific type in a Windows CE project, although these errors are not detected until compile time. The two type declaration errors you may encounter include:

  • Dim Statement As Clause Not Supported
  • Type-Declaration Characters Not Supported


Dim Statement As Clause Not Supported

Although the Dim statement is supported for Windows CE, the optional As clause is not. This clause is used to specify a particular type for the declared variable. Since all variables are of type Variant, this clause is unnecessary and can be removed.

Example of statement with this error:

Dim ThisVariable As Integer

Change to:

Dim ThisVariable


Type-Declaration Characters Not Supported

Visual Basic allows variables to be followed by a type-declaration character to specify a particular type. Since variable types are not supported for Windows CE, the type-declaration characters cause errors in a Windows CE project.

Example of statement with this error:

Dim ThisVariable%

Change to:

Dim ThisVariable

You may need to convert from a string literal.

Visual Basic appends a trailing pound sign (#) to certain large integer constants to signify that they are actually double-precision floating point values. Visual Basic does this based on the value entered, regardless of how you entered it. This syntax is incompatible with the Windows CE Toolkit for Visual Basic. To work around this problem, you can represent the number as a string literal, and convert it to double precision, as show below.

Example of statement with this error:

ThisVariable = 123456789012345#
ThisVariable = 4#

Change to:

ThisVariable = CDbl("123456789012345")
ThisVariable = CDbl("4.0")


Miscellaneous Syntax Errors

There are some differences between the syntax accepted by Visual Basic and the syntax accepted by Windows CE Toolkit for Visual Basic. This section describes some of the error messages you may encounter when using incorrect syntax.

Declare Statement Not Supported

Next Statement Does Not Take a Variable

Circle Method Not Supported

Line Method Not Supported

PSet Method Not Supported

Scale Method Not Supported


Declare Statement Not Supported

The Windows CE Toolkit for Visual Basic does not support direct calls to DLLs, so the Declare statement is not supported. To call DLL routines you should encapsulate them in an ActiveX wrapper object.

Example of this error:

Declare Sub YourRoutine Lib "YourLib.DLL" ( YourArg )
...
YourRoutine ArgValue

Change to:

WrapperObject = CreateObject( "YourWrapper.YourClass" )
...
WrapperObject.YourRoutine ArgValue


Next Statement Does Not Take a Variable

Visual Basic supports an optional variable name in the Next statement to be compatible with older Basic syntax. This variable name is not necessary, and is not supported for Windows CE.

Example of this error:

For I = 1 To 15
...
Next I

Change to:

For I = 1 To 15
...
Next


Circle Method Not Supported

Visual Basic uses an unusual syntax for the Circle method, which is not supported for Windows CE. The DrawCircle method, which has the normal method call syntax, is provided instead.

Example of statement with this error:

ThisForm.Circle (CX, CY), Radius, Color

Change to:

ThisForm.DrawCircle CX, CY, Radius, Color


Line Method Not Supported

Visual Basic uses an unusual syntax for the Line method, which is not supported for Windows CE. The DrawLine method, which has the normal method call syntax, is provided instead.

Example of statement with this error:

ThisForm.Line (X1, Y1) - (X2, Y2), Color

Change to:

ThisForm.DrawLine    X1, Y1, X2, Y2, Color


PSet Method Not Supported

Visual Basic uses an unusual syntax for the PSet method, which is not supported for Windows CE. The PointSet method, which has the normal method call syntax, is provided instead.

Example of statement with this error:

ThisForm.PSet (XPos, YPos), Color

Change to:

ThisForm.PointSet XPos, YPos, Color


Scale Method Not Supported

Visual Basic uses an unusual syntax for the Scale method, which is not supported for Windows CE. The SetScale method, which has the normal method call syntax, is provided instead.

Example of statement with this error:

ThisForm.Scale (0, 110) – (130, 0)

Change to:

ThisForm.SetScale 0, 110, 130, 0


PVB File Compilation Errors

After checking the Basic code for syntax errors, the Windows CE Toolkit for Visual Basic 5.0 consolidates code and property values for your application into a .PVB file for transport to the emulation environment or Windows CE device. You may encounter the following error messages when creating the PVB file.

Your project specifies <control name>.<property>

Windows CE Toolkit for Visual Basic only supports some of the properties allowed for intrinsic controls in Visual Basic. Unsupported properties should retain their default values, which the Toolkit verifies while creating the .PVB file. Each unsupported property found is displayed in a separate dialog box. You can cancel the listing of unsupported properties by pressing the Cancel button.

Your project specifies a control array <control name>

Control arrays are not currently supported for Windows CE. Each member of the control array has the same name, but a different non-negative Index property value. Controls that are not members of a control array have a unique (to the form) name, and an Index value of -1 (negative one). If you receive this error message, check that the indicated control has an Index value of -1.

There are too many open files

You should not get this message on a properly configured Windows NT workstation.

No write permission for file

A previous version of the local PVB file for your project was found, and either has its read-only property set or does not allow you write permissions. Either change the permissions for the file, or change the local path to a different location where a new PVB file can be created.

File is currently being used

A previous version of the local PVB file for your project was found, and some other program is currently accessing it. Close the file or exit the other program as appropriate.

PVB file larger than the available space

Your local disk drive is running short on space. Delete unnecessary files on the local disk or select an alternate location to get enough space for the PVB file.


Pocket Help Files for Windows CE

Microsoft® Windows® CE uses Pocket Help to display Help files for Windows® CE-based programs. Pocket Help files are authored in Hypertext Markup Language (HTML). The Help engine supports jumps, basic formatting, tables, and bitmaps. This chapter describes how to create Pocket Help files and what tools you will need.

Keep in mind that space on the device is extremely limited. You may want to restrict the online Help to reminders for common tasks and key commands, and place more detailed information in another medium. Windows CE compression reduces file size by 30 to 40 percent.

Topics covered in this section include:

Accessing Help

Navigation

Creating Help Files

Supported Images

Pocket Internet Explorer HTML Tag Reference


Accessing Help

Users can access Help in three ways:

  • The Help command on the Start menu.
  • The question-mark (?) button in a program or dialog box.
  • Using the shortcut keys alt+h.

When the user clicks Help on the Start menu, Pocket Help displays Help for the system including the desktop, My Handheld PC, the Start menu, and the taskbar.

In a program window or dialog box, users can display Help for the program or dialog box by clicking the question-mark button.

From any Help topic, users can access any other Help file on the system by clicking the Other Help button. Pocket Help searches for all contents files in the Windows folder and displays a list that users can choose from.


Navigation

The Pocket Help window has four navigation buttons: Contents, Back, Other Help and Expand/Collapse.

This button | Does this
Contents | Returns to the contents topic.
Back | Displays the previous topic.
Other Help | Displays a list of all Help files.
Expand/Collapse | Expands the Help window.

Scrollbars in Pocket Help enable users to scroll through a topic or list of topics.


Creating Help Files

When you create Help for a Windows CE you can choose to have all your help content in one file or you can choose to have separate content and topics files.

Creating Help using a Single File

Creating Help using Several Files


Creating Help using a Single File

Before you begin writing Help for one file, remember that:

  • All content and jumps are contained in one file (.htp).
  • Each topic is separated with a <!-- PegHelp --> separator between each section, and before the first section.
  • The .htp file must be in the Windows folder.

Creating the Help File

All of the Help topics for an application are contained in a single file instead of many smaller files.

Each contents topic contains a list of jumps to other topics. Each topic must start with the <html> tag, end with the </html> tag, and contain two parts: the head and the body.

The head section starts with the <head> tag and ends with the </head> tag. The <head> tag should contain a <meta> tag that references the name of the contents file associated with this file. Unless you are nesting a set of help files within another set, this should be blank.

Each named section is separated with <!-- PegHelp --> as a separator between each of the sections, and before the first section.

When users view the contents, the Contents button is disabled. The tag for the list of topics is <menu> </menu>.

Help File Sample

The following is a sample file that contains multiple help topics. These sections are separated with the <!-- PegHelp --> separator between the sections. It contains the table of contents as well as the information.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" Content="soltr.htp#solitaire_help">
<title>Solitaire Help</title>
</HEAD>
<BODY BGCOLOR=#FFFFFF TEXT=#000000>
<!-- PegHelp -->
<p>
<a name="solitaire_help"></a><b>Solitaire Help</b></p>
<p>
<a href="soltr.htp#playing_the_game">Playing the Game</a> </p>
<p>
<a href="soltr.htp#setting_solitaire_options">Setting Solitaire Options</a> </p>
<p>
<a href="soltr.htp#solitaire_scoring_systems">Solitaire Scoring Systems</a> </p>
<div align=right>
<a href="soltr.htp#playing_the_game"><img src="arrowr.2bp" border=0></a></div><br clear=all>
<!-- PegHelp -->
<a name="playing_the_game"></a><b>Playing the Game</b>
<ul>
<li>
To deal the cards, tap the <b>Deal</b> button.<br><br></li>
<li>
To display cards in the upper-left stack, tap the stack.</li>
<li>
To move a card to one of the row stacks, drag the card.</li>
<li>
In the row stacks, turn a card face up by tapping it.</li>
<li>
You win the game when all the cards are in the suit stacks.</li>
</ul>
<p>
<a href="soltr.htp#setting_solitaire_options">Setting Solitaire Options</a> </p>
<p>
<div align=right>
<a href="soltr.htp#solitaire_help"><img src="arrowl.2bp" border=0></a>&nbsp;
<a href="soltr.htp#setting_solitaire_options"><img src="arrowr.2bp" border=0></a>
</div><br clear=all>
<!-- PegHelp -->
<a name="setting_solitaire_options"></a><b>Setting Solitaire Options</b>
<ol>
<li>
Tap <b>Options</b>.</li>
<li>
(<b>Draw</b>) Specify whether you want to draw one card or three cards at a time.</li>
<li>
(<b>Scoring</b>) Select the type of scoring you want, if any.</li>
<li>
(<b>Card Back)</b> Select the deck style you want.</li>
<li>
Select the display options you want.</li>
</ol>
<p>
<a href="soltr.htp#playing_the_game">Playing the Game</a> </p>
<p>
<div align=right>
<a href="soltr.htp#playing_the_game"><img src="arrowl.2bp" border=0></a>
<!-- PegHelp -->
</BODY>
</HTML>


Creating Help using Several Files

If you decide to use two or more files, you will need to create a contents or .htc file (one for each application) that contains jumps to all the topics files and .htp files that contain the help topics.

Things to know before you begin writing help for two kinds of files:

  • Contents topic files have an .htc extension.
  • Each topic is a separate file with an .htp extension.
  • All .htc files must be in the Windows folder.

If .htp or .2bp files are in another folder, the full path must be specified in the <file> attribute and in the <title>, <a>, and <img src> tags. The examples in this document assume that all files are stored in the Windows folder.

Topics are authored in HTML. Pocket Help supports a subset of HTML tags. This section will cover a few of the standard tags that you will use in each file. For a complete list of supported tags please see Pocket Internet Explorer HTML Tag Reference.

The Contents .htc File

A contents topic has an .htc file name extension. When the user clicks the Help command on the Start menu, Pocket Help searches for all files with an .htc extension and displays these files in a list. Pocket Help displays the file names (without the extension) of the contents topic files.

The mainhelp.htp File

All of the help topics for an application are contained in a single file instead of many smaller files.

Each contents topic contains a list of jumps to other topics. Each topic must start with the <html> tag, end with the </html> tag, and contain two parts: the head and the body.

The head section starts with the <head> tag and ends with the </head> tag. The <head> tag should contain a <meta> tag that references the name of the contents file associated with this file. Unless you are nesting a set of help files within another set, this should be blank.

Each section is separated with <!-- PegHelp --> as a separator between each of the sections, and before the first section.

When users view the contents, the Contents button is disabled. The tag for the list of topics is <menu> </menu>.

Composing the Contents File

Each contents topics contains a list of jumps to other topics. Each topic must start with the <html> tag, end with the </html> tag, and contain two parts: the head and the body.

The head section starts with the <head> tag and ends with the </head> tag. The <head> tag should contain a <meta> tag that references the name of the contents file associated with this file. Unless you are nesting a set of help files within another set, this should be blank.

When users view the contents, the Contents button is disabled. The tag for the list of topics is <menu> </menu>.

Contents File Template

The following example provides sample HTML code for a contents file, with a screen shot showing how it looks on the H/PC.

<html>
<head>
<meta http-equiv=refer content="">
</head>
<body>
<h5>My Help Contents</h5>
<menu>
<li><a href="file:my_topic1.htp">Title for Topic 1</a>
<li><a href="file: my_topic2.htp">Title for Topic 2</a>
<li><a href="file:my_topic3.htp">Title for Topic 3</a>
<li><a href="file:my_topic4.htp">Title for Topic 4</a>
</menu>
</body>
</html>

Section Files (.htp)

These files contain the body text of your Pocket Help files. These are the files that are listed within your contents page.

Remember that since the H/PC has limited memory, Pocket Help is a companion to any desktop help files that you provide. Pocket Help should contain specific information necessary when using the device away from access to desktop help files.

Composing Help Files

Each topic must start with the <html> tag, end with the </html> tag, and contain two parts: the head and the body.

The head section starts with the <head> tag and ends with the </head> tag. This tag should include a <meta> tag that references the title of the .htp file associated with this topic. Use a naming convention that fits the needs of your project. If you have several components, you may want to use a two character abbreviation followed by a meaningful reference, for example, CD_new, where CD represents calendar and new represents the content of the topic.

Adding a Bitmap

To add a bitmap to a topic, use the anchor tag <img src> to specify the file name of a bitmap you want to include. Pocket Help files should use the .2bp extension. The following example displays an image.

<a href="soltr.htp#solitaire_help"><img src="arrowl.2bp" border=0></a>&nbsp;

Adding a Jump

To create a jump to another topic, use the anchor tag <a href> to specify the file name of the topic you want to jump to and the text that you want to be "hot."

For example:

<a href="soltr.htp#setting_solitaire_options">Setting Solitaire Options</a> </p>

In this example, Pocket Help would display Setting Solitaire Options.

Section File Template

The following example provides an HTML code sample for a topic file, with a screen shot showing how it looks on the H/PC:

<html>
<head>
<meta http-equiv=refer content="file:my_topic1.htc">
</head>
<body>
<H2>Second level heading</H2>
<p><b>This is for bold text</b>
<p>Here's where to put normal text.
</body>
</html>


Supported Images

Note that Windows CE Help supports only bitmaps as embedded images.

The following files are not supported:

  • .GIF files
  • .JPG files.


Pocket Internet Explorer HTML Tag Reference

Windows CE supports the following HTML tags:

URL formats | Version 1.0 | Version 1.1 | Version 2.0
HTTP | Yes | Yes | Yes
HTTPS | No | Yes | Yes
FTP | Yes | Yes | Yes
FILE | Yes | Yes | Yes

HTML tags | Version 1.0 | Version 1.1 | Version 2.0
A | Yes | Yes | Yes
ADDRESS | Yes | Yes | Yes
APPLET | No | No | Yes
AREA | Yes | Yes | Yes
B | Yes | Yes | Yes
BASE | No | Yes | Yes
BASEFONT | Yes | Yes | Yes
BGSOUND | Yes | Yes | Yes
BIG | Yes | Yes | Yes
BLINK | No | No | No
BLOCKQUOTE | Yes | Yes | Yes
BODY | Yes | Yes | Yes
BR | Yes | Yes | Yes
CAPTION | Yes | Yes | Yes
CENTER | Yes | Yes | Yes
CITE | Yes | Yes | Yes
CODE | Yes | Yes | Yes
DD | Yes | Yes | Yes
DFN | Yes | Yes | Yes
DIR | Yes | Yes | Yes
DIV | Yes | Yes | Yes
DL | Yes | Yes | Yes
DT | Yes | Yes | Yes
EM | Yes | Yes | Yes
FONT | Yes | Yes | Yes
FORM | Yes | Yes | Yes
FRAME | No | No | Yes
FRAMESET | No | No | Yes
Hn | Yes | Yes | Yes
HEAD | Yes | Yes | Yes
HR | Yes | Yes | Yes
HTML | Yes | Yes | Yes
I | Yes | Yes | Yes
IMG | Yes | Yes | Yes
INPUT | Yes | Yes | Yes
ISINDEX | No | No | No
KBD | Yes | Yes | Yes
LI | Yes | Yes | Yes
LINK | No | No | No
MARQUEE | No | No | No
MENU | Yes | Yes | Yes
MAP | Yes | Yes | Yes
META | Yes | Yes | Yes
NEXTID | Yes | Yes | Yes
NOBR | Yes | Yes | Yes
OBJECT | No | No | No
OL | Yes | Yes | Yes
OPTION | Yes | Yes | Yes
P | Yes | Yes | Yes
PARAM | No | No | Yes
PLAINTEXT | Yes | Yes | Yes
PRE | Yes | Yes | Yes
S | Yes | Yes | Yes
SAMP | Yes | Yes | Yes
SELECT | Yes | Yes | Yes
SMALL | Yes | Yes | Yes
STRIKE | Yes | Yes | Yes
STRONG | Yes | Yes | Yes
SUB | Yes | Yes | Yes
SUP | Yes | Yes | Yes
TABLE | Yes | Yes | Yes
TD | Yes | Yes | Yes
TEXTAREA | Yes | Yes | Yes
TH | Yes | Yes | Yes
TITLE | Yes | Yes | Yes
TR | Yes | Yes | Yes
TT | Yes | Yes | Yes
U | Yes | Yes | Yes
UL | Yes | Yes | Yes
VAR | Yes | Yes | Yes
WBR | Yes | Yes | Yes
XMP | Yes | Yes | Yes

MIME formats | Version 1.0 | Version 1.1 | Version 2.0
text/plain | Yes | Yes | Yes
text/html | Yes | Yes | Yes
image/bmp | Yes | Yes | Yes
image/gif | Yes | Yes | Yes
image/peg | Yes | Yes | Yes
image/tiff | No | No | No
image/x-xbitmap | No | No | Yes
audio/wav | Yes | Yes | Yes
audio/basic | No | No | No
audio/aiff | No | No | No
video/avi | No | No | No
video/mpeg | No | No | No

Security | Version 1.0 | Version 1.1 | Version 2.0
SSL2 | No | Yes | Yes
SSL3 | No | Yes | Yes
PCT | No | Yes | Yes


Language Reference

The Language Reference for the Windows CE Toolkit for Visual Basic 5.0 provides a complete reference of features supported in Windows CE 2.0. To help narrow your information search, these features are organized into the following sections:

  • Objects
  • Controls
  • Properties
  • Methods
  • Events
  • Functions
  • Statements
  • Constants
  • Operators


Objects

Objects

App

ClipBoard

Err

Font

Form

Screen


App

The App object is a global object accessed with the App keyword. It determines or specifies information about the application's title, version information, the path and name of its executable file, and whether or not a previous instance of the application is running.

Syntax

App

The App object properties, methods, and events listed in the following table are supported:

Properties | Methods | Events
Comments | End | None
CompanyName |  |
EXEName |  |
FileDescription |  |
LegalCopyright |  |
LegalTrademarks |  |
Major |  |
Minor |  |
Path |  |
PrevInstance |  |
ProductName |  |
Revision |  |
TaskVisible |  |
Title |  |


ClipBoard

Provides access to the system Clipboard. The Clipboard object is used to manipulate text and graphics on the Clipboard. You can use this object to enable a user to copy, cut, and paste text in your application. Before copying any material to the Clipboard object, you should clear its contents by as performing a Clear method, such as Clipboard.Clear. The Clipboard object is shared by all Windows applications, and thus, the contents are subject to change whenever you switch to another application.

Syntax

Clipboard

The Clipboard object properties, methods, and events listed in the following table are supported:

Properties | Methods | Events
None | Clear | None
 | GetFormat |
 | GetText |
 | SetText |


Err

The Err Object contains information about run-time errors. The properties of the Err object are set by the generator of an error—the toolkit, an object, or the programmer.

The Err object properties, methods, and events listed in the following table are supported:

Properties | Methods | Events
Description | Clear | None
Number | Raise |
Source |  |


Font

The Font object contains information needed to format text for display in the interface of an application.

Syntax

Font

The Font object properties, methods, and events listed in the following table are supported:

Properties | Methods | Events
Bold | None | None
Italic |  |
Name |  |
Size |  |
StrikeThrough |  |
Underline |  |
Weight |  |


Form

A Form object is a window or dialog box that makes up part of an application's user interface.

Syntax

Form

The Form object properties, methods, and events listed in the following table are supported:

Properties | Methods | Events
ActiveControl | Cls | Activate
Appearance | DrawCircle | Click
AutoRedraw | DrawLine | DblClick
BackColor | Hide | Deactivate
BorderStyle | Move | GotFocus
Caption | Point | KeyDown, KeyUp
ClipControls | PointSet | KeyPress
Controls | Refresh | Load
CurrentX | SetScale | LostFocus
CurrentY | ScaleX | MouseDown, MouseUp
DrawMode | ScaleY | MouseMove
DrawStyle | SetFocus | Paint
DrawWidth | Show | QueryUnload
Enabled | TextHeight | Resize
FillColor | TextWidth | Terminate
FillStyle | ZOrder |
Font |  |
FontBold |  |
FontItalic |  |
FontName |  |
FontSize |  |
FontStrikethru |  |
FontTransparent |  |
FontUnderline |  |
ForeColor |  |
HDC |  |
Height |  |
HWnd |  |
KeyPreview |  |
Left |  |
Moveable |  |
Name |  |
ScaleHeight |  |
ScaleLeft |  |
ScaleMode |  |
ScaleTop |  |
ScaleWidth |  |
ShowInTaskBar |  |
StartUpPosition |  |
Tag |  |
Top |  |
Visible |  |
Width |  |
WindowState |  |

Remarks

Forms have properties that determine aspects of their appearance, such as position, size, and color; and aspects of their behavior, such as whether or not they are resizable.

Forms can also respond to events initiated by a user or triggered by the system. For example, you could write code in a form's Click event procedure that would enable the user to change the color of a form by clicking it.

In addition to properties and events, you can use methods to manipulate forms using code. For example, you can use the Move method to change a form's location and size.

When designing forms, set the BorderStyle property to define a form's border, and set the Caption property to put text in the title bar. In code, you can use the Hide and Show methods to make forms invisible or visible at run-time.

Note Setting BorderStyle to 0 removes the border. If you want your form to have a border without the title bar or Control-menu box, delete any text from the form's Caption property and set the form's ControlBox properties to False.


Screen

Manipulates forms according to their placement on the screen and controls the pointer outside your application's forms at run time. The Screen object is accessed with the keyword Screen.

Syntax

Screen

The Screen object properties, methods, and events listed in the following table are supported:

Properties | Methods | Events
ActiveControl | None | None
ActiveForm |  |
FontCount |  |
Fonts |  |
Height |  |
TwipsPerPixelX |  |
TwipsPerPixelY |  |
Width |  |


ADO Control

Use the ADOcontrol to create Recordset and Field objects. The Recordset object represents the entire set of records from a base table or the results of an executed command. At any time, the Recordset object only refers to a single record within the set as the current record. The Field object represents a column of data with a common data type.

Syntax

ADO.recordset

ADO.field

The properties, methods and events of the Recordset object are described in the following table.

Properties | Methods | Events
BOF, EOF | AddNew | None
Bookmark | CancelUpdate |
EditMode | Close (ADO) |
RecordCount | Delete |
 | GetRows |
 | Move (ADO) |
 | MoveFirst, MoveLast, MoveNext, MovePrevious |
 | Open (ADO) |
 | Update |

The properties, methods and events of the Field object are described in the following table.

Properties | Methods | Events
ActualSize | None | None
Attributes |  |
Name (ADO) |  |
Type |  |
UnderlyingValue |  |
Value |  |

Remarks

For information about using the ADO control see ActiveX Data Objects in the Microsoft Platform SDK or visit the Microsoft ADO web page.


Comm Control

The Comm control provides serial communications for your application by allowing the transmission and reception of data through a serial port.

Syntax

Comm

The Comm properties, methods, and events listed in the following table are supported:

Properties | Methods | Events
Break | None | OnComm
CDHolding |  |
CommEvent |  |
CommID |  |
CommPort |  |
CTSHolding |  |
DSRHolding |  |
DTREnable |  |
Handshaking |  |
InBufferCount |  |
Index |  |
Input |  |
InputLen |  |
InputMode |  |
Name |  |
NullDiscard |  |
OutBufferCount |  |
Output |  |
Parent |  |
ParityReplace |  |
PortOpen |  |
Rthreshold |  |
RTSEnable |  |
Settings |  |
SThreshold |  |

Remarks

The Comm ActiveX control can handle communications in two ways: by notifying you when a communication event or error has occurred and by polling for events and errors.

Event-driven communications are a very powerful method for handling serial port interactions. In many situations, you want to be notified the moment an event takes place, such as when a character arrives or a change occurs in the Carrier Detect (CD) or Request To Send (RTS) lines. In such cases, use the Comm control's OnComm event to trap and handle these communications events. The OnComm event also detects and handles communications errors.

You can also poll for events and errors by checking the value of the CommEvent property after each critical function of your program. This may be preferable if your application is small and self-contained. For example, if you are writing a simple phone dialer, it may not make sense to generate an event after receiving every character, because the only characters you plan to receive are the OK response from the modem.

Each Comm control you use corresponds to one serial port. If you need to access more than one serial port in your application, you must use more than one Comm control. The port address and interrupt address can be changed from the Windows Control Panel.


Sample Code (Comm)

Example code is from a project with a Comm control on the main form named MSComm1.

Private Sub Form_Load()
Rem set properties for com port 1 at 2400 bps,
Rem no parity, 8 data bits, and 1 stop bit.
MSComm1.Settings = "2400,n,8,1"
MSComm1.CommPort = 1

Rem open the com port
MSComm1.PortOpen = True

Rem Write to the com port
MSComm1.Output = "Hello, Com port!!!"

Rem close the com port
MSComm1.PortOpen = False
End Sub

This OnComm event handler example detects an error, or tells the user when the string has been written to the Comm port.


CommonDialog Control

The CommonDialog control provides a standard set of dialog boxes for operations such as opening and saving files, and selecting colors and fonts. The control also has the ability to display help by running the Windows Help engine.

Syntax

CommonDialog

Library Name

CEComDlg

DLL Name

MSCEComDlg.dll

The CommonDialog properties, methods, and events listed in the following table are supported:

Properties | Methods | Events
CancelError | ShowOpen | None
Color | ShowSave |
DefaultExt | ShowColor |
DialogTitle | ShowFont |
FileName | ShowHelp |
FileTitle |  |
Filter |  |
FilterIndex |  |
Flags |  |
FontBold |  |
FontItalic |  |
FontStrikethru |  |
FontUnderline |  |
FontName |  |
FontSize |  |
HelpCommand |  |
HelpContext |  |
HelpFile |  |
InitDir |  |
Max, Min |  |
MaxFileSize |  |

Remarks

You use the CommonDialog control in your application by adding it to a form and setting its properties. The dialog displayed by the control is determined by the methods of the control. At run time, a dialog box is displayed or the help engine is executed, when the appropriate method is invoked; at design time, the CommonDialog control is displayed as an icon on a form. This icon cannot be sized.

The CommonDialog control can display the following commonly used dialog boxes:

  • Open
  • Save As
  • Font
  • Color

To use the common dialog control

  1. If you haven't done so already, add the CommonDialog control to the toolbox. For information on adding a control, see Installing Controls Using the Windows CE Control Manager.
  2. On the toolbox, click the CommonDialog control and draw it on a form.

    When you draw a CommonDialog control on a form, it automatically resizes itself. The CommonDialog control is invisible at run time

  3. At run time, use the appropriate method, as listed in the following table, to display the desired dialog.
Method | Dialog Box Displayed
ShowOpen | Open
ShowSave | SaveAs
ShowColor | Color
ShowFont | Font
ShowHelp | Invokes the Windows Help Engine

Note In Windows CE, common dialog boxes are not movable; they are always centered vertically and horizontally on the screen. Common dialog boxes in Windows CE always have the Help button displayed.

The Color Dialog Box

The Color common dialog box enables the user to select a color from a palette or to create and select a custom color. At run time, when the user chooses a color and closes the dialog box, you use the Color property to get the selected color.

To display the Color dialog box

  1. Set the Flags property for the CommonDialog control to the Visual Basic constant cdlCCRGBInit.
  2. Use the ShowColor method to display the dialog box

Use the Color property to get the RGB value of the color the user selects.

The Open and Save As Dialog Boxes

The Open common dialog box provides users with a way to select a file to open.

The Save As common dialog box is identical to the Open dialog box in appearance, except for the dialog's caption, and file names appearing dimmed out. At run time, when the user chooses a file and closes the dialog box, the FileName property is used to get the selected file name.

To display the Open or Save As dialog box

  1. Specify the list of file filters that are displayed in the Files of type list box by setting the Filter property.
  2. Use the ShowOpen method to display the dialog box.

After the user chooses a file, use the FileName property to get the name of the selected file.

With all the common dialog boxes, when the CancelError property is True, an error is generated when the user clicks the dialog box's Cancel button. You detect that the Cancel button was pressed by trapping the error when the dialog box is displayed.

The Font Dialog Box

The Font dialog box enables the user to select a font by its size, color, and style.

To display the Font dialog box

  1. Set the Flags property to one of the following constant values:
    • CdlCFScreenFonts (screen Fonts)
    • CdlCFPrinterFonts (printer Fonts)
    • CdlCFBoth (both screen and printer fonts)

    Note You must set the Flags property to one of these values before displaying the Font dialog box. Otherwise, the following error occurs:

No Font Exists

  2. Use the ShowFont method to display the Font dialog box.

Displaying a Help File

The ShowHelp method of the common dialog control allows you to display a Help file.

To display a Help file using the ShowHelp method

  1. Set the HelpCommand and HelpFile properties.
  2. Use the ShowHelp method to display the specified Help file.


Grid Control

The Grid control displays and operates on tabular data. It allows complete flexibility to sort, merge, and format tables containing strings.

Syntax

Grid

The properties, methods and events of the Grid control are described in the following table.

Properties | Methods | Events
CellAlignment | AddItem | Compare
CellBackColor, CellForeColor | Clear (Grid) | EnterCell
CellFontBold | RemoveItem | LeaveCell
CellFontItalic |  | RowColChange
CellFontName |  | Scroll (Grid)
CellFontSize |  | SelChange
CellFontStrikeThrough |  |
CellFontUnderline |  |
CellHeight, CellLeft, CellTop, CellWidth |  |
CellTextStyle |  |
Clip |  |
Col |  |
ColAlignment |  |
ColData |  |
CollsVisible |  |
ColPos |  |
ColPosition, RowPosition |  |
Cols, Rows |  |
ColSel, RowSel |  |
ColWidth |  |
FillStyle (Grid) |  |
FocusRect |  |
ForeColor, ForeColorSel |  |
GridColor |  |
GridLines |  |
GridLineWidth |  |
HighLight |  |
LeftCol |  |
Redraw |  |
RowHeight |  |
RowHeightMin |  |
RowIsVisible |  |
RowPos |  |
ScrollBars (Grid) |  |
ScrollTrack |  |
SelectionMode |  |
Sort |  |
Text (Grid) |  |
TextArray |  |
TextMatrix |  |
TextStyle |  |
TopRow |  |
Version |  |
WordWrap (Grid) |  |

Remarks

The Grid control supports the following features:

  • Automatic regrouping of data during column adjustment.
  • Ability of each cell to contain text.
  • Changing of current cell text in code or at run time.
  • Word-wrap capability for text within cells.

The Grid control can be used in the following scenarios:

  • To implement a "sorting" data display that groups information by category, allowing the user to modify the order in which information is presented.
  • To create a spreadsheet with in-cell editing.

The Row and Col properties specify the current cell in a Grid. You can specify the current cell in code, or the user can change it at run time using the mouse or the arrow keys. The Text property references the contents of the current cell.

If a cell's text is too long to be displayed in the cell, and the WordWrap property is set to True, the text wraps to the next line within the same cell. To display the wrapped text, you may need to increase the cell's column width (ColWidth property) or row height (RowHeight property).

Use the Cols and Rows properties to determine the number of columns and rows in a Grid control.


File System Controls

The Windows CE Toolkit for Visual Basic 5.0 File System controls work together to provide basic file input and output functionality, as well as the ability to manipulate files and directories.

The FileSystem control provides access to the File object through the File control and to the FileSystem object through the FileSystem control.

The FileSystem properties, methods, and events listed in the following table are supported:

Properties | Methods | Events
File Control |  |
Attr | Close (File) | None
EOF | Get |
Loc | Input, InputB |
LOF | InputFields |
Seek | LineInputString |
 | LinePrint |
 | Open |
 | Put |
 | WriteFields |
FileSystem Control |  | None
 | Dir |
 | FileCopy |
 | FileDateTime |
 | FileLen |
 | GetAttr |
 | Kill |
 | MkDir |
 | MoveFile |
 | RmDir |
 | SetAttr |


Finance Control

Use the Finance control to create a Finance object to access financial functions.

Syntax

Finance

The Finance control properties, methods, and events listed in the following table are supported:

Properties | Methods | Events
None | DDB | None
 | FV |
 | Ipmt |
 | IRR |
 | MIRR |
 | Nper |
 | NPV |
 | PMT |
 | PPMT |
 | PV |
 | Rate |
 | SLN |
 | SYD |

Remarks

To create a Finance Object

  • The Finance object is a non-visual object. It cannot be dropped onto a form. To use the Finance object, use the CreateObject() statement to create the object.
Dim Financial
Set Financial = CreateObject("pVBFinFunc.pVBFinFunc")
Text1.Text = Financial.Pmt(0.0083, 48, 12000)


Image Control

An Image control can display a graphic from a bitmap file. A bitmap defines an image as a pattern of dots (pixels). A bitmap has the file name extensions .bmp, .dib, or .2bp. You can use bitmaps of various color depths, including 2, 4, 8, 16, 24, and 32-bits, but a bitmap only displays correctly if the display device supports the color depth used by the bitmap. For example, an 8-bit-per-pixel (256 color) bitmap only displays in 16 colors when shown on a 4-bit-per-pixel (16 color) device.

Syntax

Image

The properties, methods and events of the Windows CE Image control are described in the following table.

Properties | Methods | Events
Picture | Refresh | None
Stretch |  |

Remarks

The image control uses fewer system resources and repaints faster than a picture box control, but it supports only a subset of the picture box control's properties, events, and methods. Both controls support bitmap picture formats. However, you can stretch pictures in an image control to fit the control's size. You cannot do this with the picture box control.

The Stretch property determines whether the picture is stretched when the image control is resized. If set to True, the picture loaded into the image control is stretched. Stretching a bitmap picture can produce a loss in image quality.


ImageList Control

An ImageList control contains a collection of images, refered to by its index. The ImageList control is not meant to be used alone, but as a central repository to conveniently supply other controls with images.

Syntax

ImageList

The properties, methods and events of the ImageList control are described in the following table.

Properties | Methods | Events
Count | Add | None
hImageList | Remove |
ImageHeight, ImageWidth | RemoveAll |
 | Replace |

Remarks

You can use the ImageList control with the Tabstrip, Listview and Treeview control.

The size of images that can be added to the ImageList control is determined by one of the following:

  • The setting of ImageWidth and ImageHeight properties before any images are added.
  • The dimensions of the first image added.

You are not limited to any particular image size, but the total number of images that can be loaded is limited by the amount of available memory.


Intrinsic Controls

The following table summarizes the intrinsic controls found in the Windows CE Toolkit for Visual Basic 5.0 toolbox.

Note All Windows CE Toolkit for Visual Basic 5.0 intrinsic controls have type IntrinsicPVB_Controls. For example, TypeName(Command1) returns "IntrinsicPVB_Controls" instead of "CommandButton".

Control Name | Name | Description
Check Box | CheckBox Control | Displays a True/False or Yes/No option. You can check any number of check boxes on a form at one time.
Combo Box | ComboBox | Combines a text box with a list box. Allows a user to type in a selection or select an item from a drop-down list.
Command Button | CommandButton | Carries out a command or action when a user clicks it.
Frame | Frame | Adds a frame to the form.
Label | Label | Displays text a user cannot interact with or modify.
Line | Line | Adds a straight-line or a box to a form.
List Box | ListBox Control | Displays a list of items that a user can choose from.
Menu | Menu | Adds a menu item.
Option Button | OptionButton | The Option Button control, as part of an option group with other option buttons, displays multiple choices, from which a user can choose only one.
Scrollbar, Hscroll, VScroll | Scrollbar Control | Allows a user to add scroll bars to controls that do not automatically provide them. (These are not the same as the built-in scroll bars found with many controls.)
Shape | Shape | Adds simple shapes to a form.
TextBox | TextBox | Provides an area to enter or display text.
Timer | Timer | Provides a timer control.

Read-only properties with illegal values are not checked during programming. All run-time properties with illegal values will raise an error message 501 "Illegal Assignment".


CheckBox Control

The CheckBox control displays a check mark when it is selected. It is commonly used to present a Yes/No or True/False selection to the user. You can use check box controls in groups to display multiple choices from which the user can select one or more.

The CheckBox control is similar to the OptionButton control in that each is used to indicate a selection that is made by the user. They differ in that only one option button in a group can be selected at a time. With the CheckBox control, however, any number of check boxes may be selected.

Syntax

CheckBox

The CheckBox control has the following properties, methods, and events.

Properties | Methods | Events
Alignment | Move | Click
Appearance | Refresh | GotFocus
BackColor, ForeColor | SetFocus | KeyDown, KeyUp
Caption | ZOrder | KeyPress
Container |  | LostFocus
Enabled |  | MouseDown, MouseUp
Font |  | MouseMove
FontBold |  |
FontItalic |  |
FontStrikethru |  |
FontUnderline |  |
FontName |  |
FontSize |  |
Height |  |
HWnd |  |
Left, Top |  |
Name |  |
Parent |  |
Style |  |
TabIndex |  |
TabStop |  |
Tag |  |
Value |  |
Visible |  |
Width |  |

Remarks

The Value property of the CheckBox control indicates whether the check box is checked, unchecked, or unavailable (dimmed). When selected, the value is set to 1. The following table lists the values that are used to set the Value property.

Setting | Value
Unchecked | 0
Checked | 1
Unavailable | 2

The user clicks the CheckBox control to indicate a checked or unchecked state. You can then test for the state of the control and program your application to perform some action based on this information.

By default, the CheckBox control is set to 0. If you want to preselect several check boxes in a series of check boxes, you can do so by setting the Value property to 1 in the Form_Load or Form_Initialize procedures.

You can also set the Value property to 2 to disable the check box. This is useful if you want to disable a check box until a certain condition is met.


ComboBox Control

A ComboBox control combines the features of a text box and a list box. This control enables the user to select an item either by typing text into the combo box, or by selecting it from the list.

Combo boxes present a list of choices to the user. If the number of items exceeds what can be displayed in the combo box, scroll bars will automatically appear on the control. The user can then scroll up and down or left to right through the list.

There are three combo box styles. Each style can be set at either design or run time and uses the following values to set the style of the combo box.

Style | Value
Drop-down Combo Box | 0
Simple Combo Box | 1
Drop-down List Box | 2

Syntax

ComboBox

The ComboBox control has the following properties, methods, and events.

Properties | Methods | Events
Appearance | AddItem | Change
BackColor, ForeColor | Clear | Click
Container | Move | DblClick
Enabled | Refresh | DropDown
Font | RemoveItem | GotFocus
FontBold | SetFocus | KeyDown, KeyUp
FontItalic | ZOrder | KeyPress
FontStrikethru |  | LostFocus
FontUnderline |  | Scroll
FontName |  |
FontSize |  |
Height, Width |  |
HWnd |  |
IntegralHeight |  |
ItemData |  |
Left, Top |  |
List |  |
ListCount |  |
ListIndex |  |
Locked |  |
Name |  |
NewIndex |  |
Parent |  |
SelLength, SelStart, SelText |  |
Sorted |  |
Style |  |
TabIndex |  |
TabStop |  |
Tag |  |
Text |  |
TopIndex |  |
Visible |  |

Remarks

Generally, a combo box is appropriate when there is a list of suggested choices, and a list box is appropriate when you want to limit input to what is on the list. A combo box contains an edit field, so choices not on the list can be typed in this field.

In addition, combo boxes save space on a form. Because the full list is not displayed until the user clicks the down arrow (except for Style 1, which is always dropped down), a combo box can easily fit in a small space where a list box would not fit.

To add or delete items in a ComboBox control, use the AddItem or RemoveItem method. Set the List, ListCount, and ListIndex properties to enable a user to access items in the ComboBox. Alternatively, you can add items to the list by using the List property at design time.

A Scroll event occurs in a ComboBox control only when the contents of the dropdown portion of the ComboBox are scrolled, not each time the contents of the ComboBox change. For example, if the dropdown portion of a combo box contains five items and the top item is highlighted, a Scroll event will not occur until you press the down arrow six times (or the PgDn key once). After that, a Scroll event occurs for each press of the down arrow key. However, if you then press the up arrow key, a Scroll event will not occur until you press the up arrow key six times (or the PgUp key once). After that, each up arrow key press will result in a Scroll event.


CommandButton Control

The CommandButton control is used to begin, interrupt, or end a process. When clicked, it invokes a command that has been written into its Click event procedure.

Most applications have command buttons that allow the user to simply click them to perform actions. When the user chooses the button, it not only carries out the appropriate action, it also looks as if it's being pushed in and released and is therefore sometimes referred to as a push button.

Syntax

CommandButton

The CommandButton control has the following properties, methods, and events.

Properties | Methods | Events
Appearance | Move | Click
BackColor, ForeColor | Refresh | GotFocus
Cancel | SetFocus | KeyDown, KeyUp
Caption | ZOrder | KeyPress
Container |  | LostFocus
Default |  | MouseDown, MouseUp
Enabled |  | MouseMove
Font |  |
FontBold |  |
FontItalic |  |
FontStrikethru |  |
FontUnderline |  |
FontName |  |
FontSize |  |
Height, Width |  |
HWnd |  |
Left, Top |  |
Name |  |
Parent |  |
Style |  |
TabIndex |  |
TabStop |  |
Tag |  |
Value |  |
Visible |  |

Remarks

To display text on a CommandButton control, set its Caption property. A user can always choose a CommandButton by clicking it. To allow the user to choose it by pressing ENTER, set the Default property to True. To allow the user to choose the button by pressing ESC, set the Cancel property of the CommandButton to True.


Frame Control

Frame controls are used to provide an identifiable grouping for other controls. For example, you can use frame controls to subdivide a form functionally—to separate groups of option button controls.

In most cases, you will use the frame control passively—to group other controls—and will have no need to respond to its events. You will, however, most likely change its Name, Caption, or Font properties.

Syntax

CommandButton

The Frame control has the following properties, methods, and events.

Properties | Methods | Events
Appearance | Move | Click
BackColor, ForeColor | Refresh | DblClick
BorderStyle | ZOrder | MouseDown, MouseUp
Caption |  | MouseMove
ClipControls |  |
Container |  |
Enabled |  |
Font |  |
FontBold |  |
FontItalic |  |
FontStrikethru |  |
FontUnderline |  |
FontName |  |
FontSize |  |
Height, Width |  |
HWnd |  |
Left, Top |  |
Name |  |
Parent |  |
TabIndex |  |
Tag |  |
Visible |  |

Remarks

When using the Frame control to group other controls, first draw the frame control, and then draw the controls inside of it. This enables you to move the frame and the controls it contains together.

To add other controls to the frame, draw them inside the frame. If you draw a control outside the frame, or use the double-click method to add a control to a form, and then try to move it inside the Frame control, the control will be on top of the frame and you'll have to move the frame and controls separately.

To select multiple controls in a frame, hold down the CTRL key while using the mouse to draw a box around the controls.


Label Control

Label controls are used to display text and cannot be edited by the user. They are used to identify objects on a form—provide a description of what a certain control will do if clicked, for example—or at run time, they can display information in response to an event or process in your application.

Syntax

Label

The Label control has the following properties, methods, and events.

Properties | Methods | Events
Alignment | Move | Change
Appearance | Refresh | Click
AutoSize | ZOrder | DblClick
BackColor, ForeColor |  | MouseDown, MouseUp
BackStyle |  | MouseMove
BorderStyle |  |
Caption |  |
Container |  |
Enabled |  |
Font |  |
FontBold |  |
FontItalic |  |
FontStrikethru |  |
FontUnderline |  |
FontName |  |
FontSize |  |
Height, Width |  |
Left, Top |  |
Name |  |
Parent |  |
TabIndex |  |
Tag |  |
UseMnemonic |  |
Visible |  |
WordWrap |  |

Remarks

Labels are used in many instances, for many different purposes. Most commonly, they are used to Label controls that don't have their own Caption properties. For example, you can use the Label control to add descriptive labels to text boxes, list boxes, combo boxes and so on. They can also be used to add descriptive text to a form, for example, to provide the user with Help information.

You can also write code that changes the text displayed by a Label control in response to events at run time. For example, if your application takes a few minutes to process a change, you can display a processing-status message in a label.

To change the text displayed in the label control, use the Caption property. At design time, you can set this property by selecting it from the control's Properties window. You can set the length of the Caption property up to a maximum of 1024 bytes.

The Alignment property allows you to set the alignment of the text within the Label control to either Left Justify (0, the default) , Center (1), or Right Justify (2).

By default, when text entered into the Caption property exceeds the width of the control, the text wraps to the next line and is clipped if it exceeds the control's height. To allow the control to automatically adjust to the size of its contents, set the AutoSize property to True. The control will expand horizontally to fit the entire contents of the Caption property. To allow the contents to wrap down and expand vertically, set the WordWrap property to True.

Because the Label control cannot receive the focus, it can also be used to create access keys for other controls. Set the UseMnemonic property to True if you want to define a character in the Caption property of the label as an access key. When you define an access key in a label control, the user can press and hold down ALT+ the character you designate to move the focus to the next control in the tab order.

You can also create access keys for any other controls that have a Caption property by adding an ampersand (&) before the letter you want to use as the access key. To assign an access key to controls that don't have captions, use a label with the control. Because labels can't receive focus, focus automatically moves to the next control in the tab order. Use this technique to assign access keys to text boxes, picture boxes, combo boxes, list boxes, drive list boxes, directory list boxes, grids, and images.

To assign an access key to a control with a label

  1. Draw the label first, and then draw the control.

    – or –

    Draw the controls in any order and set the TabIndex property of the label to one less than the control.

  2. Use an ampersand in the label's Caption property to assign the access key for the label.

Note You may want to display ampersands in a Label control, rather than using them to create access keys. This may occur if you bind a Label control to a field in a recordset where the data includes ampersands. To display ampersands in a Label control, set the UseMnemonic property to False.


Line Control

The Line control is used to create simple line segments on a form, a frame, or in a picture box. You can control the position, length, color, and style of line controls to customize the look of applications. The Line control has limited functionality and is intended for simple uses—display and printing. Line segments cannot be joined to form other shapes, for instance. For more advanced uses you need to use the DrawLine method.

Syntax

Line

The Line control has the following properties, methods, and events.

Properties | Methods | Events
BorderColor | Refresh |
BorderStyle | ZOrder |
BorderWidth |  |
Container |  |
DrawMode |  |
Name |  |
Parent |  |
Tag |  |
Visible |  |
X1,Y1,X2,Y2 |  |

Remarks

You can set the color and style of a line segment by using the BorderStyle and BorderColor properties.

You can specify a line style at design time by choosing the BorderStyle property from the Properties window of the Line control or, at run time, by specifying the style using its equivalent constant in code.

The BorderColor property is used to specify the color of the line.

At design time, you can set the line color by choosing the BorderColor property from the Properties window of the Line control and then selecting from the available palette or system colors.

To set colors at run time, use a color constant or the RGB function to specify border colors. When BorderStyle is set to 0, the BorderColor property is ignored.

You can move or resize the line control at run time by altering its X1, X2, Y1, and Y2 properties. The X1 and Y1 properties set the horizontal and vertical positions of the left end of the line segment. The X2 and Y2 properties set the horizontal and vertical positions of the right end of the line segment. You cannot move a line segment using the Move method.

To draw a line on a form

  1. In the toolbox, select the Line control.

    When the pointer moves onto the form, it changes to a cross hair.

  2. Click the form where you want the line to begin and hold down the mouse button.
  3. Drag the cross hair to where you want the line to end and release the mouse button.
  4. From the Properties window, select the BorderStyle property if you want to change the appearance of the line.
  5. In the Settings box, select the style you want.


ListBox Control

A ListBox control displays a list of items from which the user can select one or more. If the number of items exceeds the number that can be displayed, a scroll bar is automatically added to the ListBox control.

If no item is selected, the ListIndex property value is –1. The first item in the list is ListIndex 0, and the value of the ListCount property is always one more than the largest ListIndex value.

Syntax

ListBox

The ListBox control has the following properties, methods, and events.

Properties | Methods | Events
Appearance | AddItem | Click
BackColor, ForeColor | Clear | DblClick
Columns | Move | GotFocus
Container | Refresh | ItemCheck
Enabled | RemoveItem | KeyDown, KeyUp
Font | SetFocus | KeyPress
FontBold | ZOrder | LostFocus
FontItalic |  | MouseDown, MouseUp
FontStrikethru |  | MouseMove
FontUnderline |  | Scroll
FontName |  |
FontSize |  |
Height, Width |  |
HWnd |  |
ItemData |  |
Left, Top |  |
List |  |
ListCount |  |
ListIndex |  |
MultiSelect |  |
Name |  |
NewIndex |  |
Parent |  |
SelCount |  |
Selected |  |
Sorted |  |
Style |  |
TabIndex |  |
TabStop |  |
Tag |  |
Text |  |
TopIndex |  |
Visible |  |

Remarks

To add or delete items in a ListBox control, use the AddItem or RemoveItem method. Set the List, ListCount, and ListIndex properties to enable a user to access items in the ListBox. Alternatively, you can add items to the list by using the List property at design time.


Menu Control

A Menu control displays a custom menu for your application. A menu can include commands, submenus, and separator bars. Each menu you create can have up to four levels of submenus.

Syntax

Menu

The Menu control has the following properties, methods, and events.

Properties | Methods | Events
Caption |  | Click
Checked |  |
Enabled |  |
Name |  |
Parent |  |
Visible |  |

Remarks

To create a Menu control, use the Menu Editor. Enter the name of the Menu control in the Caption box. To create a separator bar, enter a single hyphen (-) in the Caption box. To display a check mark to the left of a menu item, select the Checked box.

While you can set some Menu control properties using the Menu Editor, all Menu control properties are displayed in the Properties window. To display the properties of a Menu control, select the menu name in the Objects list at the top of the Properties window.


OptionButton Control

OptionButton controls are used to display options, usually in option button groups, from which the user can choose one.

Syntax

OptionButton

The OptionButton control has the following properties, methods, and events.

Properties | Methods | Events
Alignment | Move | Click
Appearance | Refresh | DblClick
BackColor, ForeColor | SetFocus | GotFocus
Caption | ZOrder | KeyDown, KeyUp
Container |  | KeyPress
Enabled |  | LostFocus
Font |  | MouseDown, MouseUp
FontBold |  | MouseMove
FontItalic |  |
FontStrikethru |  |
FontUnderline |  |
FontName |  |
FontSize |  |
Height, Width |  |
HWnd |  |
Left, Top |  |
Name |  |
Parent |  |
Style |  |
TabIndex |  |
TabStop |  |
Tag |  |
Value |  |
Visible |  |

Remarks

You group OptionButton controls by drawing them inside a container such as a Frame control or a form. To group OptionButton controls in a Frame, draw the Frame first, and then draw the OptionButton controls inside. All OptionButton controls within the same container act as a single group.

While OptionButton controls and CheckBox controls may appear to function similarly, there is an important difference: When a user selects an OptionButton, the other OptionButton controls in the same group are automatically unavailable. In contrast, any number of CheckBox controls can be selected.


Scrollbar Control

Scroll bars provide easy navigation through a long list of items or a large amount of information by scrolling either horizontally or vertically within an application or control. They can also provide an analog representation of current position. You can use a scroll bar as an input device or indicator of speed or quantity—for example, to control the volume of a computer game or to view the time elapsed in a timed process.

Syntax

HScrollBar

VScrollBar

The Scrollbar control has the following properties, methods, and events.

Properties | Methods | Events
Container | Move | Change
Enabled | Refresh | GotFocus
Height, Width | SetFocus | KeyDown, KeyUp
HWnd | ZOrder | KeyPress
LargeChange, SmallChange |  | LostFocus
Left Top |  | Scroll
Max, Min |  |
Name |  |
Parent |  |
TabIndex |  |
TabStop |  |
Tag |  |
Value |  |
Visible |  |

Remarks

The horizontal and vertical Scrollbar controls are not the same as the built-in scroll bars found in windows or those that are attached to text boxes, list boxes, or combo boxes. Those scroll bars appear automatically whenever the given application or control contains more information than can be displayed in the current window size (or, in the case of text boxes, when the ScrollBars property is also set to True).

The scroll bar controls use the Scroll and Change events to monitor the movement of the scroll box (sometimes referred to as the thumb) along the scroll bar. Using the Scroll event provides access to the scroll bar value as it is being dragged. The Change event occurs after the scroll box is released or when the scroll bar or scroll arrows are clicked.

The Value property (which, by default, is 0) is an integer value corresponding to the position of the scroll box in the scroll bar. When the scroll box position is at the minimum value, it moves to the leftmost position (for horizontal scroll bars) or the top position (for vertical scroll bars). When the scroll box is at the maximum value, the scroll box moves to the rightmost or bottom position. Similarly, a value halfway between the bottom and top of the range places the scroll box in the middle of the scroll bar.

When you're using a scroll bar as an indicator of quantity or speed or as an input device, use the Max and Min properties to set the appropriate range for the control. Min can be larger than Max if you want your scroll bar to display information changing from a larger to a smaller value.

To specify the amount of change to report in a scroll bar, use the LargeChange property for clicking in the scroll bar, and the SmallChange property for clicking the arrows at the ends of the scroll bar. The scroll bar's Value property increases or decreases by the values set for the LargeChange and SmallChange properties. You can position the scroll box at run time by setting Value between 0 and 32,767, inclusive.


Shape Control

The Shape control is a graphical control used to create rectangles, squares, ovals, circles, rounded rectangles, or rounded squares.

Syntax

Shape

The Shape control has the following properties, methods, and events.

Properties | Methods | Events
BackColor, ForeColor | Move | None
BackStyle | Refresh |
BorderColor | ZOrder |
BorderStyle |  |
BorderWidth |  |
Container |  |
DrawMode |  |
FillColor |  |
FillStyle |  |
Height, Width |  |
Left, Top |  |
Name |  |
Parent |  |
Shape |  |
Tag |  |
Visible |  |

Remarks

You can set the shape style, color, fill style, border color, and border style of any of the shapes you draw on a form.

For simple uses, the Shape control allows you to create a variety of shapes without writing any code. For more advanced functionality you need to use the DrawLine and DrawCircle methods.

You can draw a Shape control in a container, but it can't act as a container. The effect of setting the BorderStyle property depends on the setting of the BorderWidth property. If BorderWidth is not 1 and BorderStyle is not 0 or 6, BorderStyle is set to 1.


TextBox Control

The text box control is used to display information entered by the user at run time, or assigned to the Text property of the control at design or run time.

Syntax

TextBox

The TextBox control has the following properties, methods, and events.

Properties | Methods | Events
Alignment | Move | Change
Appearance | Refresh | Click
BackColor, ForeColor | SetFocus | DblClick
BorderStyle | ZOrder | GotFocus
Container |  | KeyDown, KeyUp
Enabled |  | KeyPress
Font |  | LostFocus
FontBold |  | MouseDown, MouseUp
FontItalic |  | MouseMove
FontStrikethru |  |
FontUnderline |  |
FontName |  |
FontSize |  |
Height, Width |  |
HideSelection |  |
HWnd |  |
Left, Top |  |
Locked |  |
MaxLength |  |
MultiLine |  |
Name |  |
Parent |  |
PasswordChar |  |
ScrollBars |  |
SelLength, SelStart, SelText |  |
TabIndex |  |
TabStop |  |
Tag |  |
Text |  |
Visible |  |

Remarks

In general, the TextBox control should be used for editable text, although you can make it read-only by setting its Locked property to True. Text boxes also allow you to display multiple lines, to wrap text to the size of the control, and to add basic formatting.

Text entered into the text box control is contained in the Text property. By default, you can enter up to 2048 characters in a text box. If you set the MultiLine property of the control to True, you can enter up to 32K of text.

To display multiple lines of text in a TextBox control, set the MultiLine property to True. If a multiple-line TextBox doesn't have a horizontal scroll bar, text wraps automatically even when the TextBox is resized. To customize the scroll bar combination on a TextBox, set the ScrollBars property.

Scroll bars will always appear on the TextBox when its MultiLine property is set to True, and its ScrollBars property is set to anything except None (0).

If you set the MultiLine property to True, you can use the Alignment property to set the alignment of text within the TextBox. The text is left-justified by default. If the MultiLine property is False, setting the Alignment property has no effect.


Timer Control

A Timer control can execute code at regular intervals by causing a Timer event to occur. The Timer control, invisible to the user, is useful for background processing.

The Timer control has the following properties, methods, and events.

Properties | Methods | Events
Enabled |  | Timer
Interval |  |
Left, Top |  |
Name |  |
Parent |  |

Remarks

Timer controls respond to the passage of time. They are independent of the user, and you can program them to take actions at regular intervals. A typical response is checking the system clock to see if it is time to perform some task. Timers also are useful for other kinds of background processing.

Each Timer control has an Interval property that specifies the number of milliseconds that pass between one timer event to the next. Unless it is disabled, a timer continues to receive an event (appropriately named the Timer event) at roughly equal intervals of time.

The Interval property has a few limitations to consider when you're programming a timer control:

  • If your application or another application is making heavy demands on the system, your application may not get timer events as often as the Interval property specifies.
  • The interval can be between 0 and 64,767, inclusive, which means that even the longest interval can't be much longer than one minute (about 64.8 seconds).
  • The interval is not guaranteed to elapse exactly on time. To ensure accuracy, the timer should check the system clock when it needs to, rather than try to keep track of accumulated time internally.
  • The system generates 18 clock ticks per second—so even though the Interval property is measured in milliseconds, the true precision of an interval is no more than one-eighteenth of a second.

Every timer control must be associated with a form. Therefore, to create a timer application, you must create at least one form (though you don't have to make the form visible if you don't need it for any other purpose).

If you want the timer to start working as soon as the form loads, set the Enabled property to True. Otherwise, leave this property set to False. You might choose to have an outside event (such as a click of a command button) start operation of the timer.

The Enabled property for the timer is different from the Enabled property for other objects. With most objects, the Enabled property determines whether the object can respond to an event caused by the user. With the Timer control, setting Enabled to False suspends timer operation.


ListView Control

The ListView control displays items using one of four different views. You can arrange items into columns with or without column headings as well as display accompanying icons and text.

Syntax

ListView

The properties, methods and events of the ListView control are described in the following table.

Properties | Methods | Events
ColumnHeaders | FindItem | AfterLabelEdit
HideColumnHeaders | GetFirstVisible | BeforeLabelEdit
Icons, SmallIcons |  | ColumnClick
LabelEdit |  |
LabelWrap |  |
Listitems |  |
MultiSelect (ListView) |  |
SelectedItem |  |
Sorted (ListView) |  |
SortKey |  |
SortOrder |  |
View |  |

Remarks

With a ListView control, you can organize list entries, called ListItem objects, into one of four different views:

  • Large (standard) Icons
  • Small Icons
  • List
  • Report

The View property determines which view the control uses to display the items in the list. You can also control whether the labels associated with items in the list wrap to more than one line using the LabelWrap property. In addition, you can manage how items in the list are sorted and how selected items appear.

The ListView control contains ListItem and ColumnHeader objects. A ListItem object defines the various characteristics of items in the ListView control, such as:

  • A brief description of the item.
  • Icons that may appear with the item, supplied by an ImageList control.
  • Additional pieces of text, called subitems, associated with a ListItem object that you can display in Report view.

You can choose to display column headings in the ListView control using the HideColumnHeaders property. They can be added at both design and run time. At design time, you can use the Column Headers tab of the ListView Control Properties dialog box. At run time, use the Add method to add a ColumnHeader object to the ColumnHeaders collection.


PictureBox Control

The PictureBox control is used to display graphics on a form. It can display both.bmp and .2bp graphic files. The PictureBox control is similar to the Image control in that each can be used to display graphics in your application—each supports the bitmap graphic format. The PictureBox control, however, contains functionality which the Image control does not, for example, it supports graphics methods.

Note The PictureBox control cannot act as a container.

The PictureBox properties, methods, and events listed in the following table are supported.

Properties | Methods | Events
FontUnderline | DrawLine | Change
FontTransparent | ScaleX | Click
BackColor | DrawCircle | DblClick
BorderStyle (PictureBox) | Cls | KeyDown, KeyUp
DrawWidth | DrawPicture | KeyPress
FillColor | ScaleY | MouseDown, MouseUp
FillStyle | DrawPoint | MouseMove
FontBold | Move |
FontItalic | Refresh |
FontName | TextHeight |
FontSize | TextWidth |
FontStrikethru | SetScale |
ForeColor |  |
Height |  |
Left |  |
Picture |  |
ScaleHeight |  |
ScaleLeft |  |
ScaleMode |  |
ScaleTop |  |
ScaleWidth |  |
Tag |  |
Top |  |
Width |  |

Pictures can be loaded into the PictureBox control at design time by selecting the Picture property from the control's Properties window. When a picture is loaded into the PictureBox control, the control does not automatically resize to fit the picture.

By default, graphics are loaded into a picture box at their original size, meaning that if the graphic is larger than the control, the image will be clipped—the PictureBox control does not provide scroll bars. Unlike the Image control, the PictureBox control cannot stretch the image to fit the size of the control.

Unsupported Features

The PictureBox properties, methods, and events listed in the following table are not supported.

Properties | Methods | Events
Align | Drag | DragDrop
Appearance | LinkExecute | DragOver
AutoSize | LinkPoke | GotFocus
ClipControls | LinkRequest | LinkClose
Container | LinkSend | LinkError
CurrentX, CurrentY | OLEDrag | LinkNotify
DataChanged | Point | LinkOpen
DataField | SetFocus | LostFocus
DataSource | ShowWhatsThis | OLECompleteDrag
DragIcon | ZOrder | OLEDragDrop
DragMode |  | OLEDragOver
DrawMode |  | OLEGiveFeedback
DrawStyle |  | OLESetData
Enabled |  | OLEStartDrag
Font |  | Paint
Hdc |  |
HelpContextID |  |
HWnd |  |
Image |  |
Index |  |
LinkMode |  |
LinkTimeout |  |
LinkTopic |  |
MouseIcon |  |
MousePointer |  |
Name |  |
Negotiate |  |
OLEDropMode |  |
OLEDragMode |  |
ToolTipText |  |
Drag |  |
LinkExecute |  |
LinkPoke |  |
LinkRequest |  |
LinkSend |  |
OLEDragMode |  |
OLEDropMode |  |
Palette |  |
Parent |  |
TabIndex |  |
TabStop |  |
ToolTipText |  |
Visible |  |
WhatsThisHelpID |  |


TabStrip Control

A TabStrip control is like the dividers in a notebook or the labels on a group of file folders. By using a TabStrip control, you can define multiple pages for the same area of a window or dialog box in your application.

Syntax

TabStrip

The properties, methods and events of the TabStrip control are described in the following table.

Properties | Methods | Events
ClientHeight | Move | Click
ClientWidth | Refresh |
ClientLeft | SetFocus |
ClientTop | ZOrder |
FontBold |  |
FontItalic |  |
FontStrikethru |  |
FontUnderline |  |
FontName |  |
FontSize |  |
Height (ActiveX) |  |
Width (ActiveX) |  |
ImageList |  |
Left (ActiveX) |  |
Top (ActiveX) |  |
MultiRow |  |
Name |  |
Object |  |
Parent |  |
SelectedItem |  |
Style |  |
TabFixedHeight |  |
TabFixedWidth |  |
Tabs |  |
TabWidthStyle |  |
Visible |  |

Remarks

The control consists of one or more Tab objects in a Tabs collection. At both design-time and run-time you can affect the Tab object's appearance by setting properties. You can also add and remove tabs using the Properties Page of the TabStrip control at design time, or add and remove Tab objects at run time using methods.

The Style property determines whether the TabStrip control looks like push buttons (Buttons) or notebook tabs (Tabs). At design time when you put a TabStrip control on a form, it has one notebook tab.

To set the overall size of the TabStrip control, use its drag handles and/or set the Top, Left, Height, and Width properties. Based on the control's overall size at run time, the toolkit automatically determines the size and position of the internal area and returns the Client-coordinate properties–ClientLeft, ClientTop, ClientHeight, and ClientWidth. The MultiRow property determines whether the control can have more than one row of tabs, the TabWidthStyle property determines the appearance of each row, and, if TabWidthStyle is set to TabFixed, you can use the TabFixedHeight and TabFixedWidth properties to set the same height and width for all tabs in the TabStrip control.

The TabStrip control is not a container. To contain the actual pages and their objects, you must use Frame controls or other containers that match the size of the internal area which is shared by all Tab objects in the control.


TreeView Control

A TreeView control displays a hierarchical list of Node objects, each of which consists of a label and an optional bitmap. A TreeView is typically used to display the headings in a document, the entries in an index, the files and directories on a disk, or any other kind of information that might usefully be displayed as a hierarchy.

Syntax

TreeView

The properties, methods and events of the TreeView control are described in the following table.

Properties | Methods | Events
FontBold | GetVisibleCount | AfterLabelEdit
FontItalic | StartLabelEdit | BeforeLabelEdit
FontName |  | Collapse
FontSize |  | Expand
FontStrikeThrough |  | NodeClick
FontUnderline |  |
HideSelection |  |
ImageList |  |
Indentation |  |
LabelEdit |  |
LineStyle |  |
Nodes |  |
PathSeparator |  |
SelectedItem |  |
Sorted (TreeView) |  |
Style (TreeView) |  |

Remarks

After creating a TreeView control, you can add, manipulate, and remove Node objects by setting properties and invoking methods. You can programmatically expand and collapse Node objects to display or hide all child nodes. Three events, the Collapse, Expand, and NodeClick event, also provide programming functionality.

You can navigate through a tree in code by retrieving a reference to Node objects using Root, Parent, Child, FirstSibling, Next, Previous, and LastSibling properties. Users can navigate through a tree using the keyboard as well. UP ARROW and DOWN ARROW keys cycle downward through all expanded Node objects. Node objects are selected from left to right, and top to bottom. At the bottom of a tree, the selection jumps back to the top of the tree, scrolling the window if necessary. RIGHT ARROW and LEFT ARROW keys also tab through expanded Node objects, but if the RIGHT ARROW key is pressed while an unexpanded Node is selected, the Node expands; a second press will move the selection to the next Node. Conversely, pressing the LEFT ARROW key while an expanded Node has the focus collapses the Node. If a user presses an ANSI key, the focus will jump to the nearest Node that begins with that letter. Subsequent pressings of the key will cause the selection to cycle downward through all expanded nodes that begin with that letter.

Several styles are available which alter the appearance of the control. Node objects can appear in one of eight combinations of text, bitmaps, lines, and plus/minus signs.

The TreeView control uses the ImageList control, specified by the ImageList property, to store the bitmaps and icons that are displayed in Node objects. A TreeView control can use only one ImageList at a time. This means that every item in the TreeView control will have an equal-sized image next to it when the TreeView control's Style property is set to a style which displays images.


Winsock Control

The Winsock control, invisible to the user, uses infrared to provide two-way communication between a Windows CE device and a main computer. The Winsock control uses the IrDA protocol to provide this capability.

Syntax

Winsock

The properties, methods and events of the Windows CE Winsock control are described in the following table.

Properties | Methods | Events
BytesReceived | Accept | Close
LocalHostName | Close | ConnectionRequest
LocalIP | Connect | DataArrival
LocalPort | GetData | Error
Name | Listen | SendComplete
Parent | SendData | SendProgress
Protocol |  |
RemoteHost |  |
RemoteHostIP |  |
RemotePort |  |
SocketHandle |  |
State |  |
ServiceName |  |

Remarks

The Transfer Control Protocol allows you to create and maintain a connection to a remote computer. Using the connection, both computers can stream data between themselves.

If you are creating a client application, you must know the server computer's name or IP address (RemoteHost property), as well as the port (RemotePort property) on which it will be "listening." Then invoke the Connect method.

If you are creating a server application, set a port (LocalPort property) on which to listen, and invoke the Listen method. When the client computer requests a connection, the ConnectionRequest event will occur. To complete the connection, invoke the Accept method within the ConnectionRequest event.

Once a connection has been made, either computer can send and receive data. To send data, invoke the SendData method. Whenever data is received, the DataArrival event occurs. Invoke the GetData method within the DataArrival event to retrieve the data.


Properties

Properties

ActiveControl

ActiveForm

ActualSize

Alignment

Appearance

Attr

Attributes

AutoRedraw

AutoSize

BackColor

BackStyle

BOF, EOF (ADO)

Bold

Bookmark

BorderColor

BorderStyle

BorderStyle (PictureBox)

BorderWidth

Break

BytesReceived

Cancel

CancelError

Caption

CDHolding

CellAlignment

CellBackColor, CellForeColor

CellFontBold

CellFontItalic

CellFontName

CellFontSize

CellFontStrikeThrough

CellFontUnderline

CellHeight, CellLeft, CellTop, CellWidth

CellTextStyle

Checked

ClientHeight

ClientLeft

ClientTop

ClientWidth

Clip

ClipControls

Col

ColAlignment

ColData

CollsVisible

Color

ColPos

ColPosition, RowPosition

Cols, Rows

ColSel, RowSel

ColumnHeaders

Columns

ColWidth

Comments

CommEvent

CommID

CommPort

CompanyName

Container

Controls

Count

CTSHolding

CurrentX

CurrentY

Default

DefaultExt

Description

DialogTitle

DrawMode

DrawStyle

DrawWidth

DSRHolding

DTREnable

EditMode

Enabled

EOF

EXEName

FileDescription

FileName

FileTitle

FillColor

FillStyle

FillStyle (Grid)

Filter

FilterIndex

Flags

FocusRect

Font_vbce_Font

FontBold

FontCount

FontItalic

FontName

Fonts

FontSize

FontStrikeThrough

FontStrikethru

FontTransparent

FontUnderline

ForeColor

ForeColor, ForeColorSel

GridColor

GridLines

GridLineWidth

Handshaking

HDC

Height

Height (ActiveX)

HelpCommand

HelpContext

HelpFile

HideColumnHeaders

HideSelection

HighLight

hImageList

HWnd

Icons, SmallIcons

ImageHeight, ImageWidth

ImageList

InBufferCount

Indentation

Index

InitDir

Input

InputLen

InputMode

IntegralHeight

Interval

Italic

ItemData

KeyPreview

LabelEdit

LabelWrap

LargeChange, SmallChange

Left

Left (ActiveX)

LeftCol

LegalCopyright

LegalTrademarks

LineStyle

List

ListCount

ListIndex

ListItems

Loc

LocalHostName

LocalIP

LocalPort

Locked

LOF

Major

Max, Min

MaxLength

Minor

Moveable

MultiLine

MultiRow

MultiSelect

MultiSelect (ListView)

Name

Name (ADO)

NewIndex

Nodes

NullDiscard

Number

Object

OutBufferCount

Output

ParityReplace

Parent

PasswordChar

Path

PathSeparator

Picture

PortOpen

PrevInstance

ProductName

Protocol

RecordCount

Redraw

RemoteHost

RemoteHostIP

RemotePort

Revision

RowHeight

RowHeightMin

RowIsVisible

RowPos

RThreshold

RTSEnable

ScaleHeight

ScaleLeft

ScaleMode

ScaleTop

ScaleWidth

ScrollBars

ScrollBars (Grid)

ScrollTrack

Seek

SelCount

Selected

SelectedItem

SelectionMode

SelLength, SelStart, SelText

ServiceName

Settings

Shape

ShowInTaskBar

Size

SocketHandle

Sort

Sorted

Sorted (ListView)

Sorted (TreeView)

SortKey

SortOrder

Source

StartUpPosition

State

SThreshold

Stretch

StrikeThrough

Style

Style (TreeView)

TabIndex

Tabs

TabStop

TabWidthStyle

Tag

TaskVisible

Text

Text (Grid)

TextArray

TextMatrix

TextStyle

Title

Top

Top (ActiveX)

TopIndex

TopRow

TwipsPerPixelX

TwipsPerPixelY

Type

Underline

UnderlyingValue

UseMnemonic

Value

Value (ADO)

Version

View

Visible

Weight

Width

Width (ActiveX)

WindowState

WordWrap

WordWrap (Grid)

X1,Y1,X2,Y2


Unsupported Properties

The following properties are unsupported and should not be changed from the indicated default value. Each control on a form should have a unique name.

Property | Default Value
DataField | <blank>
DataSource | <blank>
DisabledPicture | <none>
DownPicture | <none>
DragIcon | <none>
DragMode | 0 (zero)
LinkItem | <blank>
LinkMode | 0 (zero)
LinkTimeout | 50
LinkTopic | <blank>
MaskColor | &H00C0C0C0&
MouseIcon | <none>
MousePointer | 0 (zero)
NegotiatePosition | 0 (zero)
OleDragMode | 0 (zero)
OleDropMode | 0 (zero)
Picture | <none>
RightToLeft | False
UseMaskColor | False


ActiveControl

Returns the control that has the focus. When a form is referenced, ActiveControl specifies the control that would have the focus if the referenced form were active. Not available at design time; read-only at run time.

Syntax

object.ActiveControl

The object placeholder represents an object expression that evaluates to an object.

Remarks

You can use ActiveControl to access a control's properties or to invoke its methods: For example, Screen.ActiveControl.Tag = "0". A run-time error occurs if all controls on the form are invisible or disabled.

Each form can have an active control (Form.ActiveControl), regardless of whether or not the form is active. You can write code that manipulates the active control on each form in your application even when the form is not the active form.


ActiveForm

Returns the form that is the active window.

Syntax

object.ActiveForm

The object placeholder represents an object expression that evaluates to an object.

Remarks

Use the ActiveForm property to access a form's properties or to invoke its methods — for example, Screen.ActiveForm.Height = 200.

When a control on a form has the focus, that form is the active form on the screen (Screen.ActiveForm).


ActualSize

Indicates the actual length of a field's value in bytes.

Return Value

Returns a Long value.

Remarks

Use the ActualSize property to return the actual length of a Field object's value. For all fields, the ActualSize property is read-only. If ADO cannot determine the length of the Field object's value, the ActualSize property returns adUnknown (-1).

In other versions of ADO the defined size of the field may be different from ActualSize, but as there is no concept of a defined size in ADO VB both these properties are identicial.


Alignment

Returns or sets a value that determines the alignment of the text in a CheckBox or OptionButton control. Read-only at run time for CheckBox, OptionButton, and TextBox controls.

Syntax

object.Alignment [= number]

The parts of the Alignment property syntax are described in the following table.

Part | Description
object | An object expression that evaluates to an object.
number | An integer that specifies the type of alignment, as described in Settings.

For CheckBox and OptionButton controls, the settings for number are described in the following table.

Constant | Setting | Description
vbLeftJustify | 0 | (Default). Text is left-aligned; control is right-aligned.
vbRightJustify | 1 | Text is right-aligned; control is left-aligned.

For Label and TextBox controls, the settings for number are described in the following table.

Constant | Setting | Description
vbLeftJustify | 0 | (Default). Text is left-aligned.
vbRightJustify | 1 | Text is right-aligned.
vbCenter | 2 | Text is centered.

Remarks

You can display text to the right or left of OptionButton and CheckBox controls. By default, text is left-aligned.

The MultiLine property in a Textbox control must be set to True for the Alignment property to work correctly. If the MultiLine property setting of a TextBox control is False, the Alignment property is ignored.


Appearance

Returns or sets the paint style of controls on Form object at run time. Read-only at run time.

Syntax

object.Appearance

The object placeholder represents an object expression that evaluates to an object.

Settings

The Appearance property settings are described in the following table.

Setting | Description
0 | Flat. Paints controls and forms without visual effects.
1 | 3D (default). Paints controls with three-dimensional effects.

Remarks

If set to 1 at design time, the Appearance property draws controls with three-dimensional effects. If the form's BorderStyle property is set to Fixed Dialog (vbFixedDialog, or 3), the caption and border of the form are also painted with three-dimensional effects. Setting the Appearance property to 1 also causes the form and its controls to have their BackColor property set to the color selected for 3D Objects in the Appearance tab of the operating system's Display Properties dialog box.


Attr

Returns a Long integer representing the file mode.

Syntax

file.Attr

Return Values

When the return type argument is 1, the return values listed in the following table indicate the file access mode.

Mode | Value
Input | 1
Output | 2
Random | 4
Append | 8
Binary | 32


Attributes

Sets or returns a value that indicates one or more characteristics of a Field object.

Reurn Values

For a Field object, the value specifies characteristics of the field and can be a sum of any one or more of these FieldAttributeEnum values:

Constant | Value | Description
adFldUpdatable | 4 | Indicates that you can write to the field.
adFldFixed | 16 | Indicates that the field contains fixed-length data.
adFldIsNullable | 32 | Indicates that the field accepts Null values.
adFldMayBeNull | 64 | Indicates that you can read Null values from the field.
adFldLong | 128 | Indicates that the field is a long binary field.

In ADO, the following values are always returned: adFldIsNullable, adFldMayBeNull. Other values are determined based on the actual field (adFldLong, adFldFixed) or how the recordset was opened (adFldUpdatable).


AutoRedraw

Returns or sets the output from a graphics method to a persistent graphic.

Syntax

object.AutoRedraw [= boolean]

The parts of the AutoRedraw property syntax are described in the following table.

Part | Description
object | An object expression that evaluates to an object.
boolean | A Boolean expression that specifies how the object is repainted, as described in Settings.

Settings

The settings for boolean are listed in the following table.

Setting | Description
True | Enables automatic repainting of a Form object. Graphics and text are written to the screen and to an image stored in memory. The object does not receive Paint events; it is repainted when necessary, using the image stored in memory.
False | (Default). Disables automatic repainting of an object and writes graphics or text only to the screen. Visual Basic invokes the object's Paint event when necessary to repaint the object.

Remarks

This property is central to working with the following graphics methods: DrawCircle, Cls, DrawLine, and PointSet. Setting AutoRedraw to True automatically redraws the output from these methods in a Form object when, for example, the object is resized or redisplayed after being hidden by another object.

You can set AutoRedraw in code at run time to alternate between drawing persistent graphics (such as a background or grid) and temporary graphics. If you set AutoRedraw to False, previous output becomes part of the background screen. When AutoRedraw is set to False, background graphics are not deleted if you clear the drawing area with the Cls method. Setting AutoRedraw back to True and then using Cls clears the background graphics.

Note If you set the BackColor property, all graphics and text, including the persistent graphic, are erased. In general, all graphics should be displayed using the Paint event unless AutoRedraw is set to True.


AutoSize

Returns or sets a value that determines whether a control is automatically resized to display its entire contents.

Syntax

object.AutoSize [= boolean]

The parts of the AutoSize property syntax are described in the following table.

Part | Description
object | An object expression that evaluates to an object.
boolean | A Boolean expression that specifies whether the control is resized, as described in Settings.

Settings

The settings for boolean are described in the following table.

Setting | Description
True | Automatically resizes the control to display its entire contents.
False | (Default) Keeps the size of the control constant. Contents are clipped when they exceed the area of the control.


BackColor

The BackColor property returns or sets the background color of an object. The ForeColor property returns or sets the foreground color used to display text and graphics in an object.

Syntax

object.BackColor [= color]

object.ForeColor [= color]

The parts of the BackColor and ForeColor property syntaxes are described in the following table.

Part | Description
object | An object expression that evaluates to an object.
color | A value or constant that determines the background or foreground colors of an object, as described in Settings.

Settings

Visual Basic uses the Microsoft Windows CE operating environment red-green-blue (RGB) color scheme. The settings for color are listed in the following table.

Setting | Description
Normal RGB colors | Colors specified by using the Color palette or by using the RGB function in code.
System default colors | Colors specified by system color constants listed in the Visual Basic (VB) object library in the Object Browser. The Windows operating environment substitutes the user's choices as specified in the Control Panel settings.

For all forms and controls, the default settings at design time are:

  • BackColor — set to the system default color specified by the constant vbWindowBackground.
  • ForeColor — set to the system default color specified by the constant vbWindowText.

Remarks

In the Label and Shape controls, the BackColor property is ignored if the BackStyle property setting is 0 (Transparent).

If you set the BackColor property on a Form object, all text and graphics, including the persistent graphics, are erased. Setting the ForeColor property does not affect graphics. On all other controls, the screen color changes immediately.

The valid range for a normal RGB color is 0 to 16,777,215 (&HFFFFFF). The high byte of a number in this range equals 0; the lower 3 bytes, from least to most significant byte, determine the amount of red, green, and blue, respectively. The red, green, and blue components are each represented by a number between 0 and 255 (&HFF). If the high byte is not 0, Visual Basic uses the system colors, as defined in the user's Control Panel settings and by constants listed in the Visual Basic (VB) object library in the Object Browser.

To display text in the Windows CE operating environment, both the text and background colors must be solid. If the text or background colors you have selected are not displayed, one of the selected colors may be dithered — that is, comprised of up to three different-colored pixels. If you choose a dithered color for either the text or background, the nearest solid color will be substituted.


BackStyle

Returns or sets a value indicating whether a Label control or the background of a Shape control is transparent or opaque.

Syntax

object.BackStyle [= number]

The parts of the BackStyle property syntax are described in the following table.

Part | Description
object | An object expression that evaluates to an object.
number | A numeric expression specifying transparency, as described in Settings.

Settings

The settings for number are described in the following table.

Setting | Description
0 | Transparent — background color and any graphics are visible behind the control.
1 | (Default) Opaque — the control's BackColor property setting fills the control and obscures any color or graphics behind it.

Remarks

You can use the BackStyle property to create transparent controls when you are using a background color on a Form object or when you want to place a control over a graphic. Use an opaque control when you want it to stand out.


BOF, EOF

BOF returns a value that indicates whether the current record position is before the first record in a Recordset object.

EOF returns a value that indicates whether the current record position is after the last record in a Recordset object.

Return Values

The return values for the BOF and EOF properties are Boolean values.

The BOF property returns True if the current record position is before the first record, and False if the current record position is on or after the first record.

The EOF property returns True if the current record position is after the last record, and False if the current record position is on or before the last record.

Remarks

You can use the BOF and EOF properties to determine whether a Recordset object contains records or whether you've gone beyond the limits of a Recordset object when you move from record to record.

If either the BOF or EOF property is True, there is no current record.

If you open a Recordset object containing no records, the BOF and EOF properties are set to True, and the Recordset object's RecordCount property setting is 0. When you open a Recordset object that contains at least one record, the first record is the current record and the BOF and EOF properties are False.

If you delete the last remaining record in the Recordset object, the BOF and EOF properties may remain False until you attempt to reposition the current record.

This table shows which Move methods are allowed with different combinations of the BOF and EOF properties.

 | MoveFirst, MoveLast | MovePrevious,Move < 0 | Move 0 | MoveNext, Move > 0
BOF=True, EOF=False | Allowed | Error | Error | Allowed
BOF=False, EOF=True | Allowed | Allowed | Error | Error
Both True | Error | Error | Error | Error
Both False | Allowed | Allowed | Allowed | Allowed

Allowing a Move method doesn't mean that the method will successfully locate a record. It only means that calling the specified Move method won't generate an error.

Calling the Delete method, even if it removes the only remaining record from a Recordset, won't change the setting of the BOF or EOF property.

The following table shows what happens to the BOF and EOF property settings when you call various Move methods, but are unable to successfully relocate a record.

 | BOF | EOF
MoveFirst, MoveLast | True | True
Move 0 | No change | No change
MovePrevious, Move < 0 | True | No change
MoveNext, Move > 0 | No change | True


Bold

Returns or sets the font style of the Font object to either bold or non-bold.

Syntax

object.Bold [= boolean]

The parts of the Bold property syntax are described in the following table.

Part | Description
object | An object expression that evaluates to an object
boolean | A Boolean expression specifying the font style, as described in Settings.

Settings

The settings for boolean are described in the following table.

Setting | Description
True | Turns on bold formatting.
False | Turns off bold formatting (default).

Remarks

The Font object is not directly available at design time. Instead, set the Bold property by selecting a control's Font property in the Properties window and clicking the Properties button. In the Font Style box of the Font dialog box, select either Bold or Bold Italic. At run time, however, you set Bold directly by specifying its setting for the Font object.


Bookmark

Returns a bookmark that uniquely identifies the current record in a Recordset object, or sets the current record in a Recordset object to the record identified by a valid bookmark.

Return Values

Sets or returns a Variant expression that evaluates to a bookmark.

Remarks

Use the Bookmark property to save the position of the current record and return to that record at any time.

When you open a Recordset object, each of its records has a unique bookmark. To save the bookmark for the current record, assign the value of the Bookmark property to a variable. To quickly return to that record at any time after moving to a different record, set the Recordset object's Bookmark property to the value of that variable.

The user may not be able to view the value of the bookmark. Also, users should not expect bookmarks to be directly comparable—two bookmarks that refer to the same record may have different values.


BorderColor

Returns or sets the color of an object's border.

Syntax

object.BorderColor [= color]

The parts of the BorderColor property syntax are described in the following table.

Part | Description
object | An object expression that evaluates to an object.
color | A value or constant that determines the border color, as described in Settings.

Settings

Visual Basic uses the Microsoft Windows CE operating environment red-green-blue (RGB) color scheme. The settings for color are described in the following table.

Setting | Description
Normal RGB colors | Colors specified using the Color palette or by using the RGB function in code.
System default colors | Colors specified by system color constants listed in the Visual Basic (VB) object library in the Object Browser. The system default color is specified by the vbWindowText constant. The Windows operating environment substitutes the user's choices as specified in the Control Panel settings.

Remarks

The valid range for a normal RGB color is 0 to 16,777,215 (&HFFFFFF). The high byte of a number in this range equals 0; the lower 3 bytes, from least to most significant byte, determine the amount of red, green, and blue, respectively. The red, green, and blue components are each represented by a number between 0 and 255 (&HFF). If the high byte is not 0, Visual Basic uses the system colors, as defined in the user's Control Panel settings and by constants listed in the Visual Basic (VB) object library in the Object Browser.


BorderStyle

Returns or sets the border style for an object. For the Form object and the TextBox control, read-only at run time.

Syntax

object.BorderStyle = [value]

The parts of the BorderStyle property syntax are described in the following table.

Part | Description
object | An object expression that evaluates to an object.
value | A value or constant that determines the border style, as described in Settings.

Settings

The BorderStyle property settings for a Form object are described in the following table.

Constant | Setting | Description
vbBSNone | 0 | None (no border or border-related elements).
vbFixedSingle | 1 | Fixed Single.

The BorderStyle property settings for Label, Frame, and TextBox controls are listed in the following table.

Setting | Description
0 | None (default for Label controls).
1 | Fixed Single (default for TextBox).

The BorderStyle property settings for DrawLine and Shape controls are listed in the following table.

Constant | Setting | Description
vbTransparent | 0 | Transparent
vbBSSolid | 1 | Solid (default). The border is centered on the edge of the shape.
vbBSDash | 2 | Dash


BorderStyle (PictureBox)

Returns or sets a value that indicates the border style of the control. The BorderStyle property is read/write at the control's authoring time, and read-only at the control's run time.

Syntax

object.BorderStyle [= enum]

The parts of the BorderStyle property syntax are described in the following table.

Part | Description
object | An object expression that evaluates to an object.
enum | An enumerated value that determines what the border style of the control is, as described in Settings.

Settings

The settings for enum are described in the following table.

Setting | Description
0-None | No border. This is the default value.
1-Fixed Single | A single line is drawn around the control.


BorderWidth

Returns or sets the width of a control's border.

Syntax

object.BorderWidth [= number]

The parts of the BorderWidth property syntax are described in the following table.

Part | Description
object | An object expression that evaluates to an object.
number | A numeric expression from 1 to 8192, inclusive.

Remarks

Use the BorderWidth and BorderStyle properties to specify the kind of border you want for a DrawLine or Shape control. The following table describes the effect of BorderStyle settings on the BorderWidth property.

BorderStyle | Effect on BorderWidth
0 | BorderWidth setting is ignored.
1–5 | The border width expands from the center of the border; the height and width of the control are measured from the center of the border.
6 | The border width expands inward on the control from the outside of the border; the height and width of the control are measured from the outside of the border.

Note If the BorderWidth property setting is greater than 1, the only effective settings of BorderStyle are 1 (Solid) and 6 (Inside Solid).


Break

Sets or clears the break signal state. When set to True, the Break property sends a break signal. The break signal suspends character transmission and places the transmission line in a break state until you set the Break property to False.

Typically, you set the break state for a short interval of time, and only if the device with which you are communicating requires that a break signal be set. This property is not available at design time.

Sets or clears the break signal state. This property is not available at design time.

Syntax

object.Break [ = value]

The parts of the Break property syntax are described in the following table.

Part | Description
object | An object expression that evaluates to an object.
value | A Boolean expression specifying whether the break signal state is set, as described in Settings.

Settings

The settings for value are described in the following table.

Setting | Description
True | Sets the break signal state.
False | Clears the break signal state.

Remarks

When set to True, the Break property sends a break signal. The break signal suspends character transmission and places the transmission line in a break state until you set the Break property to False.

Typically, you set the break state for a short interval of time, and only if the device with which you are communicating requires that a break signal be set.

Data Type

Boolean


BytesReceived

Returns a Long value representing the amount of data received (currently in the receive buffer). Read-only, not available at design time.

Syntax

object.BytesReceived

Return Value

Long


Cancel

Returns or sets a value indicating whether a command button is the Cancel button on a form. This command button can be the CommandButton control.

Syntax

object.Cancel [= boolean]

The parts of the Cancel property syntax are described in the following table.

Part | Description
object | An object expression that evaluates to an object.
boolean | A Boolean expression specifying whether the object is the Cancel button, as described in Settings.

Settings

The settings for boolean are described in the following table.

Setting | Description
True | The CommandButton control is the Cancel button.
False | (Default). The CommandButton control is not the Cancel button.

Remarks

Use the Cancel property to give the user the option of canceling uncommitted changes and returning the form to its previous state.

Only one CommandButton control on a form can be the Cancel button. When the Cancel property is set to True for one CommandButton, it is automatically set to False for all other CommandButton controls on the form. When a CommandButton control's Cancel property setting is True and the form is the active form, the user can choose the CommandButton by clicking it, pressing the ESC key, or pressing ENTER when the button has the focus.

Tip For a form that supports irreversible operations, such as deletions, it is a good idea to make the Cancel button the default button. To do this, set both the Cancel property and the Default property to True.


CancelError

Returns or sets a value indicating whether an error is generated when the user chooses the Cancel button.

Syntax

object.CancelError [= boolean]

The parts of the CancelError property syntax are described in the following table.

Part | Description
object | An object expression that evaluates to an object.
boolean | A Boolean expression indicating whether an error is generated, as described in Settings.

Settings

The settings for boolean are described in the following table.

Setting | Description
True | An error is generated.
False | (Default). No error is generated.

Remarks

When this property is set to True, error number 32755 (cdCancel) occurs whenever the user chooses the Cancel button.

Data Type

Boolean


Caption

For a Menu control, Caption is normally read/write at run time. But Caption is read-only for menus that are exposed or supplied by Visual Basic to add-ins, such as the MenuLine object.

Part | Description
Form | Determines the text displayed in the Form.
Control | Determines the text displayed in or next to a control.

Syntax

object.Caption [= string]

The parts of the Caption property syntax are described in the following table.

Part | Description
object | An object expression that evaluates to an object. If object is omitted, the form associated with the active form module is assumed to be object.
string | A string expression that evaluates to the text displayed as the caption.

Remarks

When you create a new object, its default caption is the default Name property setting. This default caption includes the object name and an integer, such as Command1 or Form1. For a more descriptive label, set the Caption property.

You can use the Caption property to assign an access key to a control. In the caption, include an ampersand (&) immediately preceding the character you want to designate as an access key. The character is underlined. Press the ALT key plus the underlined character to move the focus to that control. To include an ampersand in a caption without creating an access key, include two ampersands (&&). A single ampersand is displayed in the caption and no characters are underlined.

A Label control's caption size is unlimited. For forms and all other controls that have captions, the limit is 255 characters.

To display the caption for a form, set the BorderStyle property to Fixed Single (1 or vbFixedSingle). A caption that is too long for the form's title bar will be clipped.

Tip For a label, set the AutoSize property to True to automatically resize the control to fit its caption.


CDHolding

Determines whether the carrier is present by querying the state of the Carrier Detect (CD) line. Carrier Detect is a signal sent from a modem to the attached computer to indicate that the modem is online. When the Carrier Detect line is high (CDHolding = True) and times out, the Comm control sets the CommEvent property to comEventCDTO (Carrier Detect Timeout Error), and generates the OnComm event. The Carrier Detect is also known as the Receive Line Signal Detect (RLSD). This property is not available at design time and is read-only at run time.

Syntax

object.CDHolding

The parts of the CDHolding property syntax are described in the following table.

Part | Description
object | An object expression that evaluates to an object.

Settings

The settings for the CDHolding property are described in the following table.

Setting | Description
True | Carrier Detect line is high.
False | Carrier Detect line is low.

Remarks

When the Carrier Detect line is high (CDHolding = True) and times out, the Comm control sets the CommEvent property to comEventCDTO (Carrier Detect Timeout Error), and generates the OnComm event.

Note It is especially important to trap a loss of the carrier in a host application, such as a bulletin board, because the caller can hang up (drop the carrier) at any time.

The Carrier Detect is also known as the Receive Line Signal Detect (RLSD).

Data Type

Boolean


CellAlignment

Returns or sets a value that determines the alignment of data in a cell or range of selected cells. Not available at design time.

Syntax

object.CellAlignment [= value ]

The CellAlignment property syntax has these parts:

Part | Description
object | An object expression that evaluates to an object.
value | An integer specifying how text should be aligned within cells, as described in Settings.

Settings

The settings for value are:

Value | Description
0 | Left Top
1 | Left Center (default for strings)
2 | Left Bottom
3 | Center Top
4 | Center Center
5 | Center Bottom
6 | Right Top
7 | Right Center (default for numbers)
8 | Right Bottom
9 | General: Left Center for strings, Right Center for numbers


CellBackColor, CellForeColor

Returns or sets the background and foreground colors of individual cells or ranges of cells. Not available at design time.

Syntax

object.CellBackColor [= color ]

object.CellForeColor [= color ]

The CellBackColor and CellForeColor properties syntax has these parts:

Part | Description
object | An object expression that evaluates to an object.
color | Integer (enumerated). A numeric expression specifying the color for the current cell selection. Setting either of these properties to zero paints the cell using standard background and foreground colors.

Remarks

Changing this property affects the current cell or the current selection, depending on the setting of the FillStyle property.

Setting either of these properties to zero causes the Grid control to paint the cell using the standard background and foreground colors. If you want to set either of these properties to black, set them to one instead of zero.

When working with color, it is important to keep in mind how color appears when viewed on a grayscale device. The following table shows how the 16-color palette translates to four grays.

Color | Red | Green | Blue | Gray conversion
Black | 0 | 0 | 0 | Black
White | 255 | 255 | 255 | White
Dark gray | 128 | 128 | 128 | Dark gray
Light gray | 192 | 192 | 192 | Light gray
Dark red | 128 | 0 | 0 | Black
Red | 255 | 0 | 0 | Dark gray
Dark yellow | 128 | 128 | 0 | Dark gray
Yellow | 255 | 255 | 0 | Light gray
Dark green | 0 | 128 | 0 | Black
Green | 0 | 255 | 0 | Dark gray
Dark cyan | 0 | 128 | 128 | Dark gray
Cyan | 0 | 255 | 255 | Light gray
Dark blue | 0 | 0 | 128 | Black
Blue | 0 | 0 | 255 | Dark gray
Dark magenta | 128 | 0 | 128 | Dark gray
Magenta | 255 | 0 | 255 | Light gray


CellFontBold

Returns or sets the bold style for the current cell text. Not available at design time.

Syntax

object.CellFontBold [= boolean ]

The CellFontBold property syntax has these parts:

Part | Description
object | An object expression that evaluates to an object.
boolean | Determines whether the current cell text is bold. The property is False by default.

Remarks

Changing this property affects the current cell or the current selection, depending on the setting of the FillStyle property. The following code sets the text of the current cell to bold whenever the Grid control is in focus:


CellFontItalic

Returns or sets the italic style for the current cell text. Not available at design time.

Syntax

object.CellFontItalic [= boolean ]

The CellFontItalic property syntax has these parts:

Part | Description
object | An object expression that evaluates to an object.
boolean | Determines whether the text style in the cell is italic. The property is False by default.

Remarks

Changing this property affects the current cell or the current selection, depending on the setting of the FillStyle property. The following code sets the text of the current cell to Italic whenever the Grid control is in focus:


CellFontName

Returns or sets the name of the font for the current cell text. Not available at design time.

Syntax

object.CellFontName [= name ]

The CellFontName property syntax has these parts:

Part | Description
object | An object expression that evaluates to an object.
name | A string expression naming of one of the available font faces.

Remarks

Changing this property affects the current cell or the current selection, depending on the setting of the FillStyle property.


CellFontSize

Returns or sets the size, in points, for the current cell text. Not available at design time.

Syntax

object.CellFontSize [= value ]

The CellFontSize property syntax has these parts:

Part | Description
object | An object expression that evaluates to an object.
value | Single. A numeric expression specifying the size of the current cell text.

Remarks

Changing this property affects the current cell or the current selection, depending on the setting of the FillStyle property.


CellFontStrikeThrough

Returns or sets a value that determines if the FontStrikeThrough style is applied to the current cell text.

Syntax

object.CellFontStrikeThrough =[ boolean]

The CellFontStrikeThrough property syntax has these parts:

Part | Description
object | An object expression that evaluates to an object.
Boolean | A Boolean expression that specifies if the StrikeThrough style is applied to the cell text.

Settings

The settings for boolean are:

Setting | Description
True | The StrikeThrough style is applied to the cell.
False | (Default) The StrikeThrough style isn't applied to the cell.

Remarks

Changing this property affects the current cell or the current selection, depending on the setting of the FillStyle property.


CellFontUnderline

Returns or sets a value that specifies if the underline style is applied to the current cell text.

Syntax

object.CellFontUnderline =[ boolean]

The CellFontUnderline property syntax has these parts:

Part | Description
object | An object expression that evaluates to an object.
boolean | A Boolean expression that specifies if the Underline style is applied to the cell text.

Settings

The settings for boolean are:

Setting | Description
True | The Underline style is applied to the cell.
False | (Default) The Underline style isn't applied to the cell.

Remarks

Changing this property affects the current cell or the current selection, depending on the setting of the FillStyle property.


CellHeight, CellLeft, CellTop, CellWidth

Returns the position and size of the current cell, in twips. Not available at design time.

Syntax

object.CellHeight

object.CellLeft

object.CellTop

object.CellWidth

The object placeholder represents an object expression that evaluates to an object.

Remarks

These properties are useful if you want to emulate in-cell editing. By trapping the Grid control's KeyPress event, you can place a text box or some other control over the current cell and let the user edit its contents.

The return values are always in twips, regardless of the form's ScaleMode setting.


CellTextStyle

Returns or sets the three-dimensional style for text on a specific cell or range of cells. Not available at design time.

Syntax

object.CellTextStyle [= value ]

The CellTextStyle property syntax has these parts:

Part | Description
object | An object expression that evaluates to an object.
value | An integer or constant specifying one of the constants of the CellTextStyle property, as described in Settings.

Settings

The settings for value are:

Value | Description
0 | Flat (normal text)
1 | Raised
2 | Inset
3 | Raised Light
4 | Inset Light

Remarks

Settings 1 and 2 work best for large and bold fonts. Settings 3 and 4 work best for small regular fonts. The cell's appearance is also affected by the backcolor settings; some backcolor settings do not show the raised or inset feature.

Changing this property affects the current cell or the current selection, depending on the setting of the FillStyle property.


Checked

Returns or sets a value that determines whether a check mark is displayed next to a menu item.

Syntax

object.Checked [= boolean]

The parts of the Checked property syntax are described in the following table.

Part | Description
object | An object expression that evaluates to an object.
boolean | A Boolean expression that specifies whether a check mark is displayed next to a menu item.

Settings

The settings for boolean are described in the following table.

Setting | Description
True | Places a check mark next to a menu item.
False | (Default). Does not place a check mark next to a menu item.

Remarks

At design time, you can use the Menu Editor to set Checked to True. At run time, you can toggle Checked on and off as part of a Click event procedure attached to a Menu control. You can also set the value of Checked in a startup procedure or in a form's Load event procedure.


ClientHeight

Returns the coordinates of the internal area (display area) of the TabStrip control. Read-only at run time; not available at design time.

Syntax

object.ClientHeight

object.ClientWidth

object.ClientLeft

object.ClientTop

Remarks

At run time, the client-coordinate properties – ClientLeft, ClientTop, ClientHeight, and ClientWidth—automatically store the coordinates of the TabStrip control's internal area, which is shared by all Tab objects in the control. So that the controls associated with a specific Tab appear when that Tab object is selected, place the Tab object's controls inside a container, create several Frame controls, move them over the tabstrip client area, and make them visible when the corresponding tab is selected.

All client-coordinate properties use the scale mode of the parent form. To place a Frame control so it fits perfectly in the internal area, use the following code:

Frame1.Left = TabStrip1.ClientLeft
Frame1.Top = TabStrip1.ClientTop
Frame1.Width = TabStrip1.ClientWidth
Frame1.Height = TabStrip1.ClientHeight

To create the effect of placing a new tab and its associated container on top when the tab is selected:

  • Set the size and location of the container in the TabStrip control's internal area to the client-coordinate properties; and
  • Use the ZOrder method to place the selected tab's container control at the front or back of the z-order.


ClientLeft

Returns the coordinates of the internal area (display area) of the TabStrip control. Read-only at run time; not available at design time.

Syntax

object.ClientHeight

object.ClientWidth

object.ClientLeft

object.ClientTop

Remarks

At run time, the client-coordinate properties – ClientLeft, ClientTop, ClientHeight, and ClientWidth—automatically store the coordinates of the TabStrip control's internal area, which is shared by all Tab objects in the control. So that the controls associated with a specific Tab appear when that Tab object is selected, place the Tab object's controls inside a container, create several Frame controls, move them over the tabstrip client area, and make them visible when the corresponding tab is selected.

All client-coordinate properties use the scale mode of the parent form. To place a Frame control so it fits perfectly in the internal area, use the following code:

Frame1.Left = TabStrip1.ClientLeft
Frame1.Top = TabStrip1.ClientTop
Frame1.Width = TabStrip1.ClientWidth
Frame1.Height = TabStrip1.ClientHeight

To create the effect of placing a new tab and its associated container on top when the tab is selected:

  • Set the size and location of the container in the TabStrip control's internal area to the client-coordinate properties; and
  • Use the ZOrder method to place the selected tab's container control at the front or back of the z-order.


ClientTop

Returns the coordinates of the internal area (display area) of the TabStrip control. Read-only at run time; not available at design time.

Syntax

object.ClientHeight

object.ClientWidth

object.ClientLeft

object.ClientTop

Remarks

At run time, the client-coordinate properties – ClientLeft, ClientTop, ClientHeight, and ClientWidth—automatically store the coordinates of the TabStrip control's internal area, which is shared by all Tab objects in the control. So that the controls associated with a specific Tab appear when that Tab object is selected, place the Tab object's controls inside a container, create several Frame controls, move them over the tabstrip client area, and make them visible when the corresponding tab is selected.

All client-coordinate properties use the scale mode of the parent form. To place a Frame control so it fits perfectly in the internal area, use the following code:

Frame1.Left = TabStrip1.ClientLeft
Frame1.Top = TabStrip1.ClientTop
Frame1.Width = TabStrip1.ClientWidth
Frame1.Height = TabStrip1.ClientHeight

To create the effect of placing a new tab and its associated container on top when the tab is selected:

  • Set the size and location of the container in the TabStrip control's internal area to the client-coordinate properties; and
  • Use the ZOrder method to place the selected tab's container control at the front or back of the z-order.


ClientWidth

Returns the coordinates of the internal area (display area) of the TabStrip control. Read-only at run time; not available at design time.

Syntax

object.ClientHeight

object.ClientWidth

object.ClientLeft

object.ClientTop

Remarks

At run time, the client-coordinate properties – ClientLeft, ClientTop, ClientHeight, and ClientWidth—automatically store the coordinates of the TabStrip control's internal area, which is shared by all Tab objects in the control. So that the controls associated with a specific Tab appear when that Tab object is selected, place the Tab object's controls inside a container, create several Frame controls, move them over the tabstrip client area, and make them visible when the corresponding tab is selected.

All client-coordinate properties use the scale mode of the parent form. To place a Frame control so it fits perfectly in the internal area, use the following code:

Frame1.Left = TabStrip1.ClientLeft
Frame1.Top = TabStrip1.ClientTop
Frame1.Width = TabStrip1.ClientWidth
Frame1.Height = TabStrip1.ClientHeight

To create the effect of placing a new tab and its associated container on top when the tab is selected:

  • Set the size and location of the container in the TabStrip control's internal area to the client-coordinate properties; and
  • Use the ZOrder method to place the selected tab's container control at the front or back of the z-order.


Clip

Returns or sets the contents of the cells in Grid control's selected region. Not available at design time.

Syntax

object.Clip [= string ]

The Clip property syntax has these parts:

Part | Description
object | An object expression that evaluates to an object.
string | A string expression with the contents of the selected area.

Remarks

The string may hold the contents of multiple rows and columns. In string, a tab character, Chr (9), or the constant vbTab indicates a new cell in a row, and a carriage return, Chr (13) or vbCR indicates the beginning of a new row. Use the Chr function or the vb constants to embed these characters in strings.

When placing data into a Grid control, only the selected cells are affected. If there are more cells in the selected region than are described in string, the remaining cells are left alone. If there are more cells described in string than in the selected region, the unused portion of string is ignored.


ClipControls

Returns or sets a value that determines whether graphics methods in Paint events repaint the entire object or only newly exposed areas. Also determines whether the Microsoft Windows CE operating environment creates a clipping region that excludes non-graphical controls contained by the object. Read-only at run time.

Syntax

object.ClipControls

The parts of the ClipControls property syntax are described in the following table.

Part | Description
object | An object expression that evaluates to an object.
boolean | A Boolean expression that specifies how objects are repainted, as described in Settings.

Settings

The settings for boolean are described in the following table.

Setting | Description
True | (Default). Graphics methods in Paint events repaint the entire object. A clipping region is created around nongraphical controls on the form before a Paint event.
False | Graphics methods in Paint events repaint only newly exposed areas. A clipping region is not created around nongraphical controls before a Paint event. Complex forms usually load and repaint faster when ClipControls is set to False.

Remarks

Clipping is the process of determining which parts of a form or container, such as a Frame control, are painted when the form is displayed. An outline of the form and controls is created in memory. The Windows operating environment uses this outline to paint some parts, such as the background, without affecting other parts, such as the contents of a TextBox control. Because the clipping region is created in memory, setting this property to False can reduce the time needed to paint or repaint a form.

The clipping region includes most controls, but does not clip around the Label, DrawLine, or Shape controls.

Avoid nesting intrinsic controls with ClipControls set to True inside a control with ClipControls set to False (for instance, a command button inside a frame). This kind of control nesting causes the controls to repaint incorrectly. To fix this problem, set the ClipControls property for both the container control and the nested controls to True.


Col

Returns or sets the coordinates of the active cell in a Grid. Not available at design time.

Syntax

object.Col [= number ]

object.Row [= number ]

The Col, Row syntax has these parts:

Part | Description
object | An object expression that evaluates to an object.
number | Long. A numeric expression specifying the position of the active cell.

Remarks

Use these properties to specify a cell in a Grid or to find out which row or column contains the current cell. Columns and rows are numbered from zero, beginning at the top for rows and at the left for columns.

Setting these properties automatically resets RowSel and ColSel, so the selection becomes the current cell. Therefore, to specify a block selection, you must set Row and Col first, then set RowSel and ColSel.

The value of the current cell, defined by the Col and Row settings, is the text contained in that cell. To modify a cell's value without changing the selected Row and Col properties, use the TextMatrix property.


ColAlignment

Returns or sets the alignment of data in a column. Not available at design time.

Syntax

object.ColAlignment( number ) [= value ]

The ColAlignment property syntax has these parts:

Part | Description
object | An object expression that evaluates to an object.
number | Long. The number of the column in the Grid control, or -1 to set all columns at once.
value | Integer or constant specifying the alignment of data in a column, as described in Settings.

Settings

The settings for value are:

Value | Description
0 | Left Top
1 | Left Center (default for strings)
2 | Left Bottom
3 | Center Top
4 | Center Center
5 | Center Bottom
6 | Right Top
7 | Right Center (default for numbers)
8 | Right Bottom
9 | General: Left Center for strings, Right Center for numbers

Remarks

Any column can have an alignment that is different from other columns. This property affects all cells in the specified column, including those in fixed rows.

To set individual cell alignments, use the CellAlignment property.


ColData

Returns or sets an arbitrary long value associated with each row and column. Not available at design time.

Syntax

object.ColData( number ) [= value ]

object.RowData( number ) [= value ]

The ColData, RowData syntax has these parts:

Part | Description
object | An object expression that evaluates to an object.
number | Long. The number of the column or row in the Grid control where to save or retrieve the data.
value | Long. A numeric expression specifying the contents of the ColData or RowData arrays.

Remarks

Use the RowData and ColData properties to associate a specific number with each row or column on a Grid control. You can then use these numbers in code to identify the items.

For example, you can add rows containing totals to a Grid and identify those rows by setting their RowData property to a nonzero value. To update the totals later, you can delete the old totals by scanning the RowData array and removing the appropriate rows.

Another typical use of the RowData property is to keep an index into an array of data structures associated with the items described on each row.


CollsVisible

Returns a Boolean value that indicates whether a specified column is currently visible.

Syntax

object.CollsVisible( index )

The CollsVisible property syntax has these parts:

Part | Description
object | An object expression that evaluates to an object.
index | Long. The number of the column. The value must be in the range of 0 to Cols property –1.

Return Values

The return values for the CollsVisible property are:

Setting | Description
True | The specified column is currently visible.
False | The specified column is not currently visible.


Color

Returns or sets the selected color.

Syntax

object.Color [= number]

The parts of the Color property syntax are described in the following table.

Part | Description
object | An object expression that evaluates to an object.
number | A numeric expression that specifies a color

Settings

The settings for number are described in the following table.

Setting | Description
Normal RGB colors | Colors set with the RGB or QBColor functions in code.
System Default Colors | The Microsoft Windows operating environment substitutes the user's choices, as specified by the user's Control Panel settings.

Remarks

For this property to return a color in a Color dialog box, the cdlCCRGBInit flag must be set. In the Font dialog box, the cdlCFEffects flag must be set.

Data Type

Long


ColPos

Returns the distance in twips between the upper-left corner of the control and the upper-left corner of a specified column.

Syntax

object.ColPos( index )

The ColPos property syntax has these parts:

Part | Description
object | An object expression that evaluates to an object.
index | Long. The number of the column. The value must be in the range of 0 to Cols property –1.


ColPosition, RowPosition

Sets the position of a Grid row or column, allowing you to move rows and columns to specific positions.

Syntax

object.ColPosition( number ) [= value ]

object.RowPosition( number ) [= value ]

The ColPosition, RowPosition properties syntax has these parts:

Part | Description
object | An object expression that evaluates to an object.
number | Long. The number of the column or row to be moved.
value | Integer. A numeric expression specifying the new position of the column or row.

Remarks

The index and setting must correspond to valid row or column numbers (in the range 0 to Rows –1 or Cols –1) or an error will be generated.

When a row or column is moved with these properties, all formatting information moves with it, including width, height, alignment, colors, fonts, and so on. To move text only, use the Clip property instead.


Cols, Rows

Returns or sets the total number of columns or rows in a Grid.

Syntax

object.Cols [= value ]

object.Rows [= value ]

The Cols, Rows syntax has these parts:

Part | Description
object | An object expression that evaluates to an object.
value | Long. A numeric expression specifying the number of columns or rows.

Remarks

You can use these properties to expand and shrink Grid dynamically at run time.

The minimum number of rows and columns is 0. The maximum number is limited by the memory available on your computer.

The value of Cols must be at least one greater than the value of FixedCols, unless they are both set to zero. The value of Rows must be at least one greater than the value of FixedRows, unless they are both set to zero.


ColSel, RowSel

Returns or sets the starting or ending row or column for a range of cells. Not available at design time.

Syntax

object.ColSel [= value ]

object.RowSel [= value ]

The ColSel, RowSel properties syntax has these parts:

Part | Description
object | An object expression that evaluates to an object.
value | Long. A numeric expression specifying the starting or ending row or column for a range of cells.

Remarks

You can use these properties to select a specific region of Grid from code, or to read into code the dimensions of an area that the user selects.

The Grid cursor is the cell at Row, Col. The Grid selection is the region between rows Row and RowSel and columns Col and ColSel. Note that RowSel may be above or below Row, and ColSel may be to the left or to the right of Col.

Whenever you set the Row and Col properties, RowSel and ColSel are automatically reset so the cursor becomes the current selection. If you want to select a block of cells from code, you must set the Row and Col properties first, then set RowSel and ColSel.


ColumnHeaders

Returns a reference to a collection of ColumnHeader objects.

Syntax

object.ColumnHeaders

The object placeholder represents an object expression that evaluates to a ListView control.

Remarks

You can manipulate ColumnHeader objects using standard collection methods (for example, the Remove method). Each ColumnHeader in the collection can be accessed either by its Index or by a unique Key, stored in the Key property.


Columns

Returns or sets a value that determines whether a ListBox control scrolls vertically or horizontally and how the items in the columns are displayed. If it scrolls horizontally, the Columns property determines how many columns are displayed.

Syntax

object.Columns [= number]

The parts of the Columns property syntax are described in the following table.

Part | Description
object | An object expression that evaluates to an object.
number | An integer that specifies how a control scrolls and how items are arranged in columns, as described in Settings.

Settings

The settings for number are described in the following table.

Setting | Description
0 | (Default) Items are arranged in a single column and the ListBox scrolls vertically.
1 to n | Items are arranged in snaking columns, filling the first column, then the second column, and so on. The ListBox scrolls horizontally and displays the specified number of columns.

Remarks

For horizontal-scrolling ListBox controls, the column width is equal to the width of the ListBox divided by the number of columns.

This property can not be set to 0 or changed from 0 at run time — that is, you cannot change a multiple-column ListBox to a single-column ListBox or a single-column ListBox to a multiple-column ListBox at run time. However, you can change the number of columns in a multiple-column ListBox at run time.


ColWidth

Returns or sets the width of the specified column in twips. Not available at design time.

Syntax

object.ColWidth( number ) [= value ]

The ColWidth property syntax has these parts:

Part | Description
object | An object expression that evaluates to an object.
number | Long. The number of the column in the Grid control, or –1 to set all columns at once.
value | A numeric expression specifying the width of the specified column in twips.

Remarks

You can use this property to set the width of any column at run time. You can set ColWidth to zero to create invisible columns, or to –1 to reset the column width to its default value, which depends on the size of the current font.


Comments

Returns or sets a string containing comments about the running application. Read-only at run time.

Syntax

object.Comments

The object placeholder represents an object expression that evaluates to an object.

Remarks

You can set this property at design time in the Type box in the Make tab of the Project Properties dialog box.


CommEvent

Returns the most recent communication event or error. This property is not available at design time and is read-only at run time.

Syntax

object.CommEvent

The parts of the CommEvent property syntax are described in the following table.

Part | Description
object | An object expression that evaluates to an object.

Remarks

Although the OnComm event is generated whenever a communication error or event occurs, the CommEvent property holds the numeric code for that error or event. To determine the actual error or event that caused the OnComm event, you must reference the CommEvent property.

The CommEvent property returns one of the values found in the following tables for communication errors or events.

ComEvent Property Error Values

Error Value | Description
1001 | A Break signal was received.
1002 | Clear To Send Timeout. The Clear To Send line was low for the system specified amount of time while trying to transmit a character.
1003 | Data Set Ready Timeout. The Data Set Ready line was low for the system specified amount of time while trying to transmit a character.
1004 | Framing Error. The hardware detected a framing error.
1006 | Port Overrun. A character was not read from the hardware before the next character arrived and was lost.
1007 | Carrier Detect Timeout. The Carrier Detect line was low for the system specified amount of time while trying to transmit a character. Carrier Detect is also known as the Receive Line Signal Detect (RLSD).
1008 | Receive Buffer Overflow. There is no room in the receive buffer.
1009 | Parity Error. The hardware detected a parity error.
1010 | Transmit Buffer Full. The transmit buffer was full while trying to queue a character.
1011 | Unexpected error retrieving Device Control Block (DCB) for the port.

ComEvent Property Event Values

Value | Description
1 | There are fewer than Sthreshold number of characters in the transmit buffer.
2 | Received Rthreshold number of characters. This event is generated continuously until you use the Input property to remove the data from the receive buffer.
3 | Change in Clear To Send line.
4 | Change in Data Set Ready line. This event is only fired when DSR changes from 1 to 0.
5 | Change in Carrier Detect line.
6 | Ring detected. Some UARTs (universal asynchronous receiver-transmitters) may not support this event.
7 | End Of File (ASCII character 26) character received.


CommID

Returns a handle that identifies the communications device. This property is not available at design time and is read-only at run time. This is the same value that is returned by the Windows CE API CreateFile function.

Returns a handle that identifies the communications device. This property is not available at design time and is read-only at run time.

Syntax

object.CommID

The parts of the CommID property syntax are described in the following table.

Part | Description
object | An object expression that evaluates to an object.

Data Type

Long


CommPort

Sets and returns the communications port number. You can set this value to any number between 1 and 16 at design time (the default is 1). However, the Comm control generates error 68 (Device unavailable) if the port does not exist when you attempt to open it with the PortOpen property.

Sets and returns the communications port number.

Syntax

object.CommPort[ = value ]

The parts of the CommPort property syntax are described in the following table.

Part | Description
object | An object expression that evaluates to an object.
value | A integer value specifying the port number.

Remarks

You can set value to any number between 1 and 16 at design time (the default is 1). However, the Comm control generates error 68 (Device unavailable) if the port does not exist when you attempt to open it with the PortOpen property.

Note You must set the CommPort property before opening the port.

Data Type

Integer


CompanyName

Returns or sets a string value containing the name of the company or creator of the running application. Read-only at run time.

Syntax

object.CompanyName

The object placeholder represents an object expression that evaluates to an object.

Remarks

You can set this property at design time in the Type box in the Make tab of the Project Properties dialog box.


Container

Returns or sets the container of a control on a Form. Not available at design time.

Syntax

Set object.Container [= container]

The parts of the Container property syntax are described in the following table.

Part | Description
object | An object expression that evaluates to an object.
container | An object expression that evaluates to an object that can serve as a container for other controls.


Controls

A collection whose elements represent each control on a form.

Syntax

object.Controls(index)

The parts of the Controls collection syntax are described in the following table.

Part | Description
object | An object expression that evaluates to a Form object.
Index | An integer with a range from 0 to the number of Controls - 1.

Remarks

The Controls collection enumerates loaded controls on a form and is useful for iterating through them. The Controls collection identifies an intrinsic form-level variable named Controls. If you omit the optional object placeholder, you must include the Controls keyword. However, if you include object, you can omit the Controls keyword.

Example

Add a ListBox control named List1 to a form named Form1. Add several other controls to Form1. Add the following code to Form1, run the program, and click on the form (not on a control). The names of the controls on Form1 will be displayed in List1.

Private Sub Form_Click()
    Dim ExitFlag, Index
    ExitFlag = False
    Index = 0
    On Error Resume Next
    Do
        List1.AddItem Form1.Controls(Index).Name
        'List1.AddItem Form1(Index).Name 'will also work.
        If Err.Number = 0 Then
            Index = Index + 1
        Else
            ExitFlag = True
        End If
    Loop Until ExitFlag
End Sub


Count

Returns the number of images in a list.

Syntax

object.Count

An object is an expression that evaluates to an object.


CTSHolding

Determines whether you can send data by querying the state of the Clear To Send (CTS) line. Typically, the Clear To Send signal is sent from a modem to the attached computer to indicate that transmission can proceed. This property is not available at design time and is read-only at run time.

Syntax

object.CTSHolding

The parts of the CTSHolding property syntax are described in the following table.

Part | Description
object | An object expression that evaluates to an object.

The following table lists the CTSHolding property settings for the Comm control.

Setting | Description
True | Clear To Send line high.
False | Clear To Send line low.

Remarks

When the Clear To Send line is low (CTSHolding = False) and times out, the Comm control sets the CommEvent property to comEventCTSTO (Clear To Send Timeout) and invokes the OnComm event.

The Clear To Send line is used in RTS/CTS (Request To Send/Clear To Send) hardware handshaking. The CTSHolding property gives you a way to manually poll the Clear To Send line if you need to determine its state.

For more information on handshaking protocols, see the Handshaking property.

Data Type

Boolean


CurrentX

Returns or sets the horizontal (CurrentX) or vertical (CurrentY) coordinates for the next drawing method. Not available at design time.

Syntax

object.CurrentX [= x]
object.CurrentY [= y]

The parts of the CurrentX and CurrentY properties syntax are described in the following table.

Part | Description
object | An object expression that evaluates to an object.
x | A number that specifies the horizontal coordinate.
y | A number that specifies the vertical coordinate.

Remarks

Coordinates are measured from the upper-left corner of an object. The CurrentX property setting is 0 at an object's left edge, and the CurrentY property setting is 0 at its top edge. Coordinates are expressed in twips, or the current unit of measurement defined by the ScaleHeight, ScaleWidth, ScaleLeft, ScaleTop, and ScaleMode properties.

When you use the following graphics methods, the CurrentX and CurrentY settings are changed as indicated:

This method | Sets CurrentX, CurrentY to
DrawCircle | The center of the object.
Cls | 0, 0.
DrawLine | The end point of the line.
PointSet | The point drawn.


CurrentY

Returns or sets the horizontal (CurrentX) or vertical (CurrentY) coordinates for the next drawing method. Not available at design time.

Syntax

object.CurrentX [= x]
object.CurrentY [= y]

The parts of the CurrentX and CurrentY properties syntax are described in the following table.

Part | Description
object | An object expression that evaluates to an object.
x | A number that specifies the horizontal coordinate.
y | A number that specifies the vertical coordinate.

Remarks

Coordinates are measured from the upper-left corner of an object. The CurrentX property setting is 0 at an object's left edge, and the CurrentY property setting is 0 at its top edge. Coordinates are expressed in twips, or the current unit of measurement defined by the ScaleHeight, ScaleWidth, ScaleLeft, ScaleTop, and ScaleMode properties.

When you use the following graphics methods, the CurrentX and CurrentY settings change as indicated in the following table.

This method | Sets CurrentX, CurrentY to
DrawCircle | The center of the object.
Cls | 0, 0.
DrawLine | The end point of the line.
PointSet | The point drawn.


Default

Returns or sets a value that determines which CommandButton control is the default command button on a form.

Syntax

object.Default [= boolean]

The parts of the Default property syntax are described in the following table.

Part | Description
object | An object expression that evaluates to an object.
boolean | A Boolean expression that specifies whether the command button is the default, as described in Settings.

Settings

The settings for boolean are described in the following table.

Setting | Description
True | The CommandButton is the default command button.
False | (Default). The CommandButton is not the default command button.

Remarks

Only one command button on a form can be the default command button. When Default is set to True for one command button, it is automatically set to False for all other command buttons on the form. When the command button's Default property setting is True and its parent form is active, the user can choose the command button (invoking its Click event) by pressing ENTER. Any other control with the focus does not receive a keyboard event (KeyDown, KeyPress, or KeyUp) for the ENTER key unless the user has moved the focus to another command button on the same form. In this case, pressing ENTER chooses the command button that has the focus instead of the default command button.

For a form or dialog box that supports an irreversible action such as a delete operation, make the Cancel button the default command button by setting its Default property to True.


DefaultExt

Returns or sets the default filename extension for the dialog box.

Syntax

object.DefaultExt [= string]

The parts of the DefaultExt property syntax are described in the following table.

Part | Description
object | An object expression that evaluates to an object.
string | A string expression specifying the file extension.

Remarks

Use this property to specify a default filename extension, such as .txt or .doc. When a file with no extension is saved, the extension specified by this property is automatically appended to the filename.

Data Type

String


Description

Returns or sets a descriptive string associated with an error.

Syntax

object.Description [= stringexpression]

The parts of the Description property syntax are described in the following table.

Part | Description
object | Always the Err object.
stringexpression | A string expression containing a description of the error.

Remarks

The Description property consists of a short description of the error. Use this property to alert the user to an error that you cannot or do not want to handle. When generating a user-defined error, assign a short description of your error to this property. If Description is not filled in, and the value of Number corresponds to a run-time error, the descriptive string associated with the error is returned.


DialogTitle

Returns or sets a string displayed in the title bar of the dialog box.

Syntax

object.DialogTitle [= title]

The parts of the DialogTitle property syntax are described in the following table.

Part | Description
object | An object expression that evaluates to an object.
title | A string expression specifying the name of the dialog box.

Remarks

Use this property to display the name of the dialog box in the title bar.

Note The CommonDialog control ignores the setting of the DialogTitle property when displaying the Color, Font, or Print dialog boxes.

The default title for an Open dialog box is Open; the default title for a Save As dialog box is Save As.

Data Type

String


DrawMode

Returns or sets a value that determines the appearance of output from graphics method or the appearance of a Shape or Line control.

Syntax

object.DrawMode [= number]

The parts of the DrawMode property syntax are described in the following table.

Part | Description
object | An object expression that evaluates to an object.
number | An integer that specifies appearance, as described in Settings.

Settings

The settings for number are described in the following table.

Constant | Setting | Description
vbBlackness | 1 | Blackness.
vbNotMergePen | 2 | Not Merge Pen — Inverse of setting 15 (Merge Pen).
vbMaskNotPen | 3 | Mask Not Pen — Combination of the colors common to the background color and the inverse of the pen.
vbNotCopyPen | 4 | Not Copy Pen — Inverse of setting 13 (Copy Pen).
vbMaskPenNot | 5 | Mask Pen Not — Combination of the colors common to both the pen and the inverse of the display.
vbInvert | 6 | Invert — Inverse of the display color.
vbXorPen | 7 | Xor Pen — Combination of the colors in the pen and in the display color, but not in both.
vbNotMaskPen | 8 | Not Mask Pen — Inverse of setting 9 (Mask Pen).
vbMaskPen | 9 | Mask Pen — Combination of the colors common to both the pen and the display.
vbNotXorPen | 10 | Not Xor Pen — Inverse of setting 7 (Xor Pen).
vbNop | 11 | Nop — No operation — output remains unchanged. In effect, this setting turns drawing off.
vbMergeNotPen | 12 | Merge Not Pen — Combination of the display color and the inverse of the pen color.
vbCopyPen | 13 | Copy Pen (Default) — Color specified by the ForeColor property.
vbMergePenNot | 14 | Merge Pen Not — Combination of the pen color and the inverse of the display color.
vbMergePen | 15 | Merge Pen — Combination of the pen color and the display color.
vbWhiteness | 16 | Whiteness.

Remarks

Use this property to produce visual effects with Shape or Line controls or when drawing with the graphics methods. Visual Basic compares each pixel in the draw pattern to the corresponding pixel in the existing background and then applies bit-wise operations. For example, setting 7 (Xor Pen) uses the Xor operator to combine a draw pattern pixel with a background pixel.

The exact effect of a DrawMode setting depends on the way the color of a line drawn at run time combines with colors already on the screen. Settings 1, 6, 7, 11, 13, and 16 yield the most predictable results.


DrawStyle

Returns or sets a value that determines the line style for output from graphics methods.

Syntax

object.DrawStyle [= number]

The parts of the DrawStyle property syntax are described in the following table.

Part | Description
object | An object expression that evaluates to an object.
number | An integer that specifies line style, as described in Settings.

Settings

The settings for number are described in the following table.

Constant | Setting | Description
vbSolid | 0 | (Default) Solid
vbDash | 1 | Dash

Remarks

If DrawWidth is set to a value greater than 1, DrawStyle setting 1 produces a solid line (the DrawStyle property value is not changed). If DrawWidth is set to 1, DrawStyle produces the effect described in the preceding table for each setting.


DrawWidth

Returns or sets the line width for output from graphics methods.

Syntax

object.DrawWidth [= size]

The parts of the DrawWidth property syntax are described in the following table.

Part | Description
object | An object expression that evaluates to an object.
size | A numeric expression from 1 through 32,767. This value represents the width of the line in pixels. The default is 1; that is, 1 pixel wide.

Remarks

Increase the value of this property to increase the width of the line. If the DrawWidth property setting is greater than 1, DrawStyle property setting 1 produces a solid line (the DrawStyle property value is not changed). Setting DrawWidth to 1 allows DrawStyle to produce the results shown in the DrawStyle property table.


DSRHolding

Determines the state of the Data Set Ready (DSR) line. Typically, the Data Set Ready signal is sent by a modem to its attached computer to indicate that it is ready to operate. This property is not available at design time and is read-only at run time.

Syntax

object.DSRHolding

The DSRHolding property returns the values described in the following table.

Value | Description
True | Data Set Ready line high
False | Data Set Ready line low

Remarks

When the Data Set Ready line is high (DSRHolding = True) and has timed out, the Comm control sets the CommEvent property to comEventDSRTO (Data Set Ready Timeout) and invokes the OnComm event.

This property is useful when writing a Data Set Ready/Data Terminal Ready handshaking routine for a Data Terminal Equipment (DTE) machine.

Data Type

Boolean


DTREnable

Determines whether to enable the Data Terminal Ready (DTR) line during communications. Typically, the Data Terminal Ready signal is sent by a computer to its modem to indicate that the computer is ready to accept incoming transmission.

Syntax

object.DTREnable[ = value ]

The parts of the DTREnable property syntax are described in the following table.

Part | Description
object | An object expression that evaluates to an object.
Value | A Boolean expression specifying whether to enable the Data Terminal Ready (DTR) line, as described in Settings.

Settings

The settings for value are described in the following table.

Setting | Description
True | Enable the Data Terminal Ready line.
False | (Default) Disable the Data Terminal Ready line.

Remarks

When the DTREnable property is set to True, the Data Terminal Ready line is set to high (on) when the port is opened, and low (off) when the port is closed. When DTREnable is set to False, the Data Terminal Ready always remains low.

In most cases, setting the Data Terminal Ready line to low hangs up the telephone.

Data Type

Boolean


EditMode

Indicates the editing status of the current record.

Return Values

Returns one of the following EditModeEnum values:

Constant | Value | Description
adEditNone | 0 | No editing operation is in progress.
adEditInProgress | 1 | Data in the current record has been modified but not yet saved.
adEditAdd | 2 | The AddNew method has been invoked, and the current record in the copy buffer is a new record that hasn't been saved in the database.

Use the EditMode property to determine the editing status of the current record. You can test for pending changes if an editing process has been interrupted and determine whether you need to use the Update or CancelUpdate method.

See the AddNew method for a more detailed description of the EditMode property under different editing conditions.


Enabled

Returns or sets a value that determines whether a form or control can respond to user-generated events.

Syntax

object.Enabled [= boolean]

The parts of the Enabled property syntax are described in the following table.

Part | Description
object | An object expression that evaluates to an object. If object is omitted, the form associated with the active form module is assumed to be object.
boolean | A Boolean expression that specifies whether object can respond to user-generated events.

Settings

The settings for boolean are described in the following table.

Setting | Description
True | (Default). Allows object to respond to events.
False | Prevents object from responding to events.

Remarks

The Enabled property allows forms and controls to be enabled or disabled at run time. For example, you can disable objects that do not apply to the current state of the application. You can also disable a control used purely for display purposes, such as a text box that provides read-only information.

Disabling a Timer control by setting Enabled to False cancels the countdown set up by the control's Interval property.


EOF

Returns True when the end of a file opened for random or sequential input has been reached.

Syntax

File.EOF

Remarks

Use the EOF function to avoid the error generated by attempting to get input past the end of a file.

The EOF function returns False until the end of the file has been reached. With files opened for Random or Binary access, EOF returns False until the last executed Get statement is unable to read an entire record.

With files opened for Binary access, an attempt to read through the file using the Input function until EOF returns True generates an error. Use the LOF and Loc functions instead of EOF when reading binary files with Input, or use Get when using the EOF function. With files opened for Output, EOF always returns True.


EXEName

Returns the root name of the executable file (without the extension) that is currently running. If running in the development environment, returns the name of the project.

Syntax

object.EXEName

The object placeholder represents an object expression that evaluates to an object.


FileDescription

Returns or sets a string value containing file description information about the running application. Read-only at run time.

Syntax

object.FileDescription

The object placeholder represents an object expression that evaluates to an object.

Remarks

You can set this property at design time in the Type box in the Make tab of the Project Properties dialog box.


FileName

Returns or sets the path and filename of a selected file.

Syntax

object.FileName [ = pathname]

The parts of the FileName property syntax are described in the following table.

Part | Description
object | An object expression that evaluates to an object.
value | A string expression that specifies the path and filename.

Remarks

In the CommonDialog control, you can set the FileName property before opening a dialog box to set an initial filename. Reading this property returns the currently selected filename from the list. If no file is selected, FileName returns a zero-length string.

When setting this property, you can include the name of an existing file (without wildcard characters) in the string to select the file.


FileTitle

Returns the name (without the path) of the file to open or save.

Syntax

object.FileTitle

The object placeholder is an object expression that evaluates to an object.

Remarks

When the user selects a file and clicks OK in the File dialog box, the FileTitle property takes a value that can then be used to open or save the selected file.

Data Type

String


FillColor

Returns or sets the color used to fill in shapes. FillColor is also used to fill in circles and boxes created with the DrawCircle and DrawLine graphics methods.

Syntax

object.FillColor [ = value]

The parts of the FillColor property syntax are described in the following table.

Part | Description
object | An object expression that evaluates to an object.
value | A value or constant that determines the fill color, as described in Settings.

Settings

The settings for value are described in the following table.

Setting | Description
Normal RGB colors | Colors set with the RGB function in code.
System default colors | Colors specified with the system color constants in the Visual Basic (VB) object library in the Object Browser. The Microsoft Windows CE operating environment substitutes the user's choices, as specified by the user's Control Panel settings.

By default, FillColor is set to 0 (Black). For the PictureBox control, FillColor is set to WindowText.

Remarks

Except for the Form object, when the FillStyle property is set to its default, 1 (Transparent), the FillColor setting is ignored.


FillStyle

Returns or sets the pattern used to fill Shape controls as well as circles and boxes created with the DrawCircle and DrawLine graphics methods.

Syntax

object.FillStyle [= number]

The parts of the FillStyle property syntax are described in the following table.

Part | Description
object | An object expression that evaluates to an object.
number | An integer that specifies the fill style, as described in Settings.

Settings

The number settings are described in the following table.

Constant | Setting | Description
vbFSSolid | 0 | Solid
vbFSTransparent | 1 | (Default) Transparent

Remarks

When FillStyle is set to 1 (Transparent), the FillColor property is ignored, except for the Form object.


FillStyle (Grid)

Returns or sets a value that determines whether setting the Text property or one of the cell formatting properties of a Grid applies the change to all selected cells.

Syntax

object.FillStyle[ = value ]

The FillStyle property syntax has these parts:

Part | Description
object | An object expression that evaluates to an object.
value | Integer or constant that specifies the fill style, as described in Settings.

Settings

The settings for value are:

Value | Description
0 | Single (default). Changing Text or any of the cell properties only affects the active cell.
1 | Repeat. Changing the Text or any of the cell properties affects all selected cells.

Remarks

FillStyle must be set to 1(Repeat) whenever you want a cell change to apply to all cells.


Filter

Returns or sets the filters that are displayed in the Type list box of a dialog box.

Syntax

object.Filter [= description1|filter1|description2|filter2…]

The parts of the Filter property syntax are described in the following table.

Part | Description
object | An object expression that evaluates to an object.
description | A string expression describing the type of file.
filter | A string expression specifying the filename extension.

Remarks

A filter specifies the type of files that are displayed in the dialog box's file list box. For example, selecting the filter *.txt displays all text files.

Use this property to provide the user with a list of filters that can be selected when the dialog box is displayed.

Use the pipe ( | ) symbol (ASCII 124) to separate the description and filter values. Do not include spaces before or after the pipe symbol, because these spaces will be displayed with the description and filter values.

The following code shows an example of a filter that enables the user to select text files or graphic files that include bitmaps and icons:

Text (*.txt)|*.txt|Pictures (*.bmp;*.ico)|*.bmp;*.ico

When you specify more than one filter for a dialog box, use the FilterIndex property to determine which filter is displayed as the default.

Data Type

String


FilterIndex

Returns a default filter for an Open or Save As dialog box.

Syntax

object.FilterIndex [= number]

The parts of the FilterIndex property syntax are described in the following table.

Part | Description
object | An object expression that evaluates to an object.
description | A string expression describing the type of file.
filter | A numeric expression specifying a default filter.

Remarks

This property specifies the default filter when you use the Filter property to specify filters for an Open or Save As dialog box.

The index for the first defined filter is 1.

Data Type

Integer


Flags

Returns or sets the options for a Color, Font, Open, or Save As dialog box.

Syntax

object.Flags [= value]

The parts of the Flags property syntax are described in the following table.

Part | Description
object | An object expression that evaluates to an object.
value | A constant or value specifying the options for a Color, Font, Open, or Save As dialog box.

Settings

The value settings for the Color dialog box are described in the following table.

Setting | Description
&H2 | Entire dialog box is displayed, including the Define Custom Colors section.
&H4 | Disables the Define Custom Colors command button and prevents the user from defining custom colors.
&H1 | Sets the initial color value for the dialog box.

The value settings for the Open and Save As dialog boxes are described in the following table.

Setting | Description
&H2000 | Specifies that the dialog box prompts the user to create a file that doesn't currently exist. This flag automatically sets the cdlOFNPathMustExist and cdlOFNFileMustExist flags.
&H400 | Indicates that the extension of the returned filename is different from the extension specified by the DefaultExt property. This flag isn't set if the DefaultExt property is Null, if the extensions match, or if the file has no extension. This flag value can be checked upon closing the dialog box.
&H1000 | Specifies that the user can enter only names of existing files in the File Name text box. If this flag is set and the user enters an invalid filename, a warning is displayed. This flag automatically sets the cdlOFNPathMustExist flag.
&H4 | Hides the Read Only check box.
&H200000 | Use long filenames.
&H8 | Forces the dialog box to set the current directory to what it was when the dialog box was opened.
&H100000 | Do not dereference shell links (also known as shortcuts). By default, choosing a shell link causes it to be dereferenced by the shell.
&H40000 | No long file names.
&H2 | Causes the Save As dialog box to generate a message box if the selected file already exists. The user must confirm whether to overwrite the file.
&H800 | Specifies that the user can enter only valid paths. If this flag is set and the user enters an invalid path, a warning message is displayed.

Remarks

You can also define selected flags. Use the Const keyword in the Declarations section of the startup form to define the flags you want to use.

You can set more than one flag for a dialog box using the Or operator. For example:

CommonDialog1.Flags = &H10 Or &H200

Adding the desired constant values produces the same results. The following is equivalent to the preceding example:

CommonDialog1.Flags = &H210

Data Type

Long


FocusRect

Returns or sets a value that determines whether the Grid control should draw a focus rectangle around the current cell.

Syntax

object.FocusRect [= value ]

The FocusRect property syntax has these parts:

Part | Description
object | An object expression that evaluates to an object.
value | Integer or constant that specifies the focus rectangle style, as described in Settings.

Settings

The settings for value are:

Value | Description
0 | None. No focus rectangle around current cell.
1 | Light (default). Light focus rectangle around current cell.
2 | Heavy. Heavy focus rectangle around current cell.

Remarks

If a focus rectangle is drawn, then the current cell is painted in the background color, as in most spreadsheets and grids. Otherwise, the current cell is painted in the selection color, so you can see which cell is selected even without the focus rectangle.

For example, the following code sets the focus rectangle for the active cell to a Light Rectangle, using the constant value.

Sub Form1_Load ()
    Grid1.FocusRect = 1
End Sub


Font

Returns a Font object.

Syntax

object.Font

The object placeholder represents an object.

Remarks

Use the Font property of an object to identify a specific Font object whose properties you want to use. For example, the following code changes the Bold property setting of a Font object identified by the Font property of a TextBox object:

txtFirstName.Font.Bold = True


FontBold

Returns or sets font styles in the following formats: Bold, Italic, Strikethru, and Underline.

Syntax

object.FontBold [= boolean]

object.FontItalic [= boolean]

object.FontStrikethru [= boolean]

object.FontUnderline [= boolean]

The parts of the FontBold, FontItalic, FontStrikethru, and FontUnderline property syntaxes are described in the following table.

Part | Description
object | An object expression that evaluates to an object.
boolean | A Boolean expression specifying the font style as described in Settings.

Settings

The settings for boolean are described in the following table.

Setting | Description
True | Turns on the formatting in that style (default for FontBold, except with the CommonDialog and TreeView controls).
False | Turns off the formatting in that style (default for FontItalic, FontStrikethru, FontUnderline.)

Remarks

Use these font properties to format text, either at design time using the Properties window or at run time using code. For Form object, setting these properties does not affect graphics or text already drawn on the control or object. For all other controls, font changes take effect on screen immediately.

To use these properties with the CommonDialog control, the Effects flag must be set.

Note Fonts available in the toolkit vary depending on your system configuration and display devices. Font-related properties can be set only to values for which actual fonts exist.

In general, you should change the FontName property before you set size and style attributes with the FontSize, FontBold, FontItalic, FontStrikethru, and FontUnderline properties. However, when you set TrueType fonts to smaller than 8 points, you should set the point size with the FontSize property, then set the FontName property, and then set the size again with the FontSize property.


FontCount

Returns the number of fonts available for the current display device.

Syntax

object.FontCount

The object placeholder represents an object expression that evaluates to an object.

Remarks

Use this property with the Fonts property to see a list of available screenfonts. Fonts available in Visual Basic vary according to your system configuration and display devices.


FontItalic

Returns or sets font styles in the following formats: Bold, Italic, Strikethru, and Underline.

Syntax

object.FontBold [= boolean]

object.FontItalic [= boolean]

object.FontStrikethru [= boolean]

object.FontUnderline [= boolean]

The parts of the FontBold, FontItalic, FontStrikethru, and FontUnderline property syntaxes are described in the following table.

Part | Description
object | An object expression that evaluates to an object.
boolean | A Boolean expression specifying the font style as described in Settings.

Settings

The settings for boolean are described in the following table.

Setting | Description
True | Turns on the formatting in that style (default for FontBold, except with the CommonDialog and TreeView controls).
False | Turns off the formatting in that style (default for FontItalic, FontStrikethru, FontUnderline.)

Remarks

Use these font properties to format text, either at design time using the Properties window or at run time using code. For Form object, setting these properties does not affect graphics or text already drawn on the control or object. For all other controls, font changes take effect on screen immediately.

To use these properties with the CommonDialog control, the Effects flag must be set.

Note Fonts available in the toolkit vary depending on your system configuration and display devices. Font-related properties can be set only to values for which actual fonts exist.

In general, you should change the FontName property before you set size and style attributes with the FontSize, FontBold, FontItalic, FontStrikethru, and FontUnderline properties. However, when you set TrueType fonts to smaller than 8 points, you should set the point size with the FontSize property, then set the FontName property, and then set the size again with the FontSize property.


FontName

Returns or sets the font used to display text in a control or in a run-time drawing or printing operation. This property is not available at design-time for the TreeView control.

Note The FontName property is included for use with the CommonDialog control. For additional functionality, use the new Font object properties (not available for the CommonDialog control).

Syntax

object.FontName [= font]

The parts of the FontName property syntax are described in the following table.

Part | Description
object | An object expression that evaluates to an object.
font | A string expression specifying the font name to use.

Remarks

The default for this property is determined by the system. Fonts available with the toolkit vary depending on your system configuration and display devices. Font-related properties can be set only to values for which fonts exist.

In general, you should change FontName before setting size and style attributes with the FontSize, FontBold, FontItalic, FontStrikethru, and FontUnderline properties.

Note At run time, you can get information on fonts available to the system through the FontCount and Fonts properties.


Fonts

Returns all font names available for the current display device.

Syntax

object.Fonts(index)

The parts of the Fonts property syntax are described in the following table.

Part | Description
object | An object expression that evaluates to an object.
index | An integer from 0 to FontCount - 1.

Remarks

The Fonts property works in conjunction with the FontCount property, which returns the number of font names available for the object. Fonts available in Visual Basic vary according to your system configuration, display devices, and printing devices. Use both the Fonts and the FontCount properties to get information about available screen fonts.


FontSize

Returns or sets the size of the font to be used for text displayed in a control or in a run-time drawing or printing operation. This property is not available at design-time for the TreeView control.

Note The FontName property is included for use with the CommonDialog control. For additional functionality, use the new Font object properties (not available for the CommonDialog control).

Syntax

object.FontSize [= points]

The parts of the FontSize property syntax are described in the following table.

Part | Description
object | An object expression that evaluates to an object.
points | A numeric expression specifying the font size to use, in points.

Remarks

Use this property to format text in the font size you want. The default is determined by the system. To change the default, specify the size of the font in points.

The maximum value for FontSize is 2160 points.

Note Fonts available with the toolkit vary depending on your system configuration, display devices, and printing devices. Font-related properties can be set only to values for which fonts exist.

In general, you should change the FontName property before you set size and style attributes with the FontSize, FontBold, FontItalic, FontStrikethru, and FontUnderline properties. However, when you set TrueType fonts to smaller than 8 points, you should set the point size with the FontSize property, then set the FontName property, and then set the size again with the FontSize property.


FontStrikethrough

Returns or sets the strikethrough style for the displayed text. This property is not available at design time.

Syntax

object.FontStrikethrough [= boolean]

The parts of the FontStrikethrough property syntax are described in the following table.

Part | Description
object | An object expression that evaluates to an object.
boolean | A Boolean expression specifying the font style as described in Settings.

Settings

The settings for boolean are described in the following table.

Setting | Description
True | Turns on the formatting in the strikethrough style
False | Turns off the formatting in the strikethrough style. False is the default setting.


FontStrikethru

Returns or sets the strikethrough style in the following formats: Bold, Italic, Strikethru, and Underline.

Syntax

object.FontBold [= boolean]

object.FontItalic [= boolean]

object.FontStrikethru [= boolean]

object.FontUnderline [= boolean]

The parts of the FontBold, FontItalic, FontStrikethru, and FontUnderline property syntaxes are described in the following table.

Part | Description
object | An object expression that evaluates to an object.
boolean | A Boolean expression specifying the font style as described in Settings.

Settings

The settings for boolean are described in the following table.

Setting | Description
True | Turns on the formatting in that style (default for FontBold, except with the CommonDialog control).
False | Turns off the formatting in that style (default for FontItalic, FontStrikethru, FontUnderline.)

Remarks

Use these font properties to format text, either at design time using the Properties window or at run time using code. For Form object, setting these properties does not affect graphics or text already drawn on the control or object. For all other controls, font changes take effect on screen immediately.

To use these properties with the CommonDialog control, the Effects flag must be set.

Note Fonts available in Visual Basic vary depending on your system configuration, display devices, and printing devices. Font-related properties can be set only to values for which actual fonts exist.

In general, you should change the FontName property before you set size and style attributes with the FontSize, FontBold, FontItalic, FontStrikethru, and FontUnderline properties. However, when you set TrueType fonts to smaller than 8 points, you should set the point size with the FontSize property, then set the FontName property, and then set the size again with the FontSize property.


FontTransparent

Returns or sets a value that determines whether background text and graphics on a Form control are displayed in the spaces around characters.

Syntax

object.FontTransparent [= boolean]

The parts of the FontTransparent property syntax are described in the following table.

Part | Description
object | An object expression that evaluates to an object.
boolean | A Boolean expression specifying the state of background text and graphics, as described in Settings.

Settings

The settings for boolean are described in the following table.

Setting | Description
True | (Default) Permits background graphics and text to show around the spaces of the characters in a font.
False | Masks existing background graphics and text around the characters of a font.

Remarks

Set FontTransparent at design time using the Properties window or at run time using code. Changing FontTransparent at run time does not affect graphics and text already drawn to a Form property.


FontUnderline

Returns or sets font styles in the following formats: Bold, Italic, Strikethru, and Underline.

Syntax

object.FontBold [= boolean]

object.FontItalic [= boolean]

object.FontStrikethru [= boolean]

object.FontUnderline [= boolean]

The parts of the FontBold, FontItalic, FontStrikethru, and FontUnderline property syntaxes are described in the following table.

Part | Description
object | An object expression that evaluates to an object.
boolean | A Boolean expression specifying the font style as described in Settings.

Settings

The settings for boolean are described in the following table.

Setting | Description
True | Turns on the formatting in that style (default for FontBold, except with the CommonDialog and TreeView controls).
False | Turns off the formatting in that style (default for FontItalic, FontStrikethru, FontUnderline.)

Remarks

Use these font properties to format text, either at design time using the Properties window or at run time using code. For Form object, setting these properties does not affect graphics or text already drawn on the control or object. For all other controls, font changes take effect on screen immediately.

To use these properties with the CommonDialog control, the Effects flag must be set.

Note Fonts available in Visual Basic vary depending on your system configuration, display devices, and printing devices. Font-related properties can be set only to values for which actual fonts exist.

In general, you should change the FontName property before you set size and style attributes with the FontSize, FontBold, FontItalic, FontStrikethru, and FontUnderline properties. However, when you set TrueType fonts to smaller than 8 points, you should set the point size with the FontSize property, then set the FontName property, and then set the size again with the FontSize property. The Microsoft Windows CE operating environment uses a different font for TrueType fonts that are smaller than 8 points.


ForeColor

The BackColor property returns or sets the background color of an object. The ForeColor property returns or sets the foreground color used to display text and graphics in an object.

Syntax

object.BackColor [= color]

object.ForeColor [= color]

The parts of the BackColor and ForeColor property syntaxes are described in the following table.

Part | Description
object | An object expression that evaluates to an object.
color | A value or constant that determines the background or foreground colors of an object, as described in Settings.

Settings

Visual Basic uses the Microsoft Windows CE operating environment red-green-blue (RGB) color scheme. The settings for color are described in the following table.

Setting | Description
Normal RGB colors | Colors specified by using the Color palette or by using the RGB function in code.
System default colors | Colors specified by system color constants listed in the Visual Basic (VB) object library in the Object Browser. The Windows operating environment substitutes the user's choices as specified in the Control Panel settings.

For all forms and controls, the default settings at design time are:

  • BackColor — set to the system default color specified by the constant vbWindowBackground.
  • ForeColor — set to the system default color specified by the constant vbWindowText.

Remarks

In the Label and Shape controls, the BackColor property is ignored if the BackStyle property setting is 0 (Transparent).

If you set the BackColor property on a Form object, all text and graphics, including the persistent graphics, are erased. Setting the ForeColor property does not affect graphics or print output already drawn. On all other controls, the screen color changes immediately.

The valid range for a normal RGB color is 0 to 16,777,215 (&HFFFFFF). The high byte of a number in this range equals 0; the lower 3 bytes, from least to most significant byte, determine the amount of red, green, and blue, respectively. The red, green, and blue components are each represented by a number between 0 and 255 (&HFF). If the high byte is not 0, Visual Basic uses the system colors, as defined in the user's Control Panel settings and by constants listed in the Visual Basic (VB) object library in the Object Browser.

To display text in the Windows operating environment, both the text and background colors must be solid. If the text or background colors you have selected are not displayed, one of the selected colors may be dithered — that is, comprised of up to three different-colored pixels. If you choose a dithered color for either the text or background, the nearest solid color will be substituted.


ForeColor, ForeColorSel

Returns or sets the color used to draw text on each part of the Grid control.

Syntax

object.ForeColor [= color ]

object.ForeColorSel [= color ]

The ForeColor and ForeColorSel properties syntax have these parts:

Part | Description
object | An object expression that evaluates to an object.
color | A value or constant that determines the color used to paint text in the scrollable or fixed areas of Grid.

Remarks

The picture below shows what part of Grid the properties refer to:

Use the ForeColor property to set the text color of all nonfixed cells. To set the text color of individual cells, use the CellForeColor property.


GridColor

Returns or sets the color used to draw the lines between the Grid control's cells.

Syntax

object.GridColor [= color ]

The GridColor property syntax has these parts:

Part | Description
object | An object expression that evaluates to an object.
color | A value or constant that determines the color used to paint the gridlines in the scrollable or fixed areas of Grid.

Remarks

The GridColor property is used only when the GridLines property is set to 1 (Lines). Raised and inset grid lines are always drawn in black and white.


GridLines

Returns or sets a value that determines what type of lines should be drawn between cells.

Syntax

object.GridLines [= value ]

The GridLines property syntax have these parts:

Part | Description
object | An object expression that evaluates to an object.
value | An integer or constant specifying the type of lines drawn, as described in Settings.

Settings

The settings for value are:

Value | Description
0 | No Lines. No lines in-between cells.
1 | Lines(default for GridLines). Sets line style between cells to normal lines.
2 | Inset Lines. Sets line style between cells to inset lines.
3 | Raised Lines. Sets line style between cells to raised lines.

Remarks

When the GridLines property is set to 1 (Lines), the color of the lines is determined by the GridColor property. Raised and inset grid lines are always drawn in black and white.


GridLineWidth

Returns or sets the width in pixels of the gridlines for an Grid control.

Syntax

object.GridLineWidth [= value]

The GridLineWidth property syntax has these parts:

Part | Description
object | An object expression that evaluates to an object.
value | An integer specifying the gridline width. The minimum setting is 1 (default); the maximum setting is 10.


Handshaking

Sets and returns the hardware handshaking protocol.

Syntax

object.Handshaking [ = value ]

The parts of the Handshaking property syntax are described in the following table.

Part | Description
object | An object expression that evaluates to an object.
value | An integer expression specifying the handshaking protocol, as described in Settings.

Settings

The settings for value are described in the following table.

Value | Description
0 | (Default) No handshaking.
1 | XON/XOFF handshaking.
2 | RTS/CTS (Request To Send/Clear To Send) handshaking.
3 | Both Request To Send and XON/XOFF handshaking.

Remarks

Handshaking refers to the internal communications protocol by which data is transferred from the hardware port to the receive buffer. When a character of data arrives at the serial port, the communications device has to move it into the receive buffer so that your program can read it. If there is no receive buffer and your program is expected to read every character directly from the hardware, you will probably lose data because the characters can arrive very quickly.

A handshaking protocol insures data is not lost due to a buffer overrun, where data arrives at the port too quickly for the communications device to move the data into the receive buffer.

Data Type

Integer


HDC

Returns a handle provided by the Microsoft Windows CE operating environment to the device context of an object.

Syntax

object.hDC

The object placeholder represents an object expression that evaluates to an object.

Remarks

This property is a Windows operating environment device context handle. The Windows operating environment manages the system display by assigning a device context for an object and for each form in your application. You can use the hDC property to refer to the handle for an object's device context.

Note The value of the hDC property can change while a program is running, so do not store the value in a variable; instead, use the hDC property each time you need it.


Height

Measured from the center of the control's border so that controls with different border widths align correctly. These properties use the scale units of a control's container.

Syntax

object.Height [= number]

object.Width [= number]

The parts of the Height and Width property syntaxes are described in the following table.

Part | Description
object | An object expression that evaluates to an object.
number | A numeric expression specifying the dimensions of an object, as described in Settings.

Settings

Measurements are calculated as follows:

  • Form — the external height and width of the form, including the borders and title bar.
  • Control — measured from the center of the control's border so that controls with different border widths align correctly. These properties use the scale units of a control's container.
  • Screen object — the height and width of the screen; not available at design time and read-only at run time.

Remarks

For Form and Screen objects, these properties are always measured in twips. For a form or control, the values for these properties change as the object is sized by the user or by your code. Maximum limits of these properties for all objects are system-dependent.

Use the Height, Width, Left, and Top properties for operations or calculations based on an object's total area, such as sizing or moving the object. Use the ScaleLeft, ScaleTop, ScaleHeight, and ScaleWidth properties for operations or calculations based on an object's internal area, such as drawing or moving objects within another object.

The Height property cannot be changed for the DriveListBox control or for the ComboBox control, whose Style property setting is 0 (Dropdown Combo) or 2 (Dropdown List).


Height (ActiveX)

Returns or sets the dimensions of an object.

Syntax

object.Height [= number]

object.Width [= number]

The Height and Width property syntaxes have these parts:

Part | Description
number | A numeric expression specifying the dimensions of an object, as described in Settings.

Settings

Measurements are measured from the center of the control's border so that controls with different border widths align correctly. These properties use the scale units of a control's container.

Remarks

For a control, the values for these properties change as the object is sized by the user or by your code. Maximum limits of these properties for all objects are system-dependent.

Use the Height, Width, Left, and Top properties for operations or calculations based on an object's total area, such as sizing or moving the object.


HelpCommand

Returns or sets the type of online Help requested.

Syntax

object.HelpCommand [ = value ]

The parts of the HelpCommand property syntax are described in the following table.

Part | Description
object | An object expression that evaluates to an object.
value | A value or constant that specifies the type of Help, as described in Settings.

Settings

The settings for value are described in the following table.

Value | Description
&H1 | Displays Help for a particular context. When using this setting, you must also specify a context using the HelpContext property.

Data Type

Integer


HelpContext

Returns or sets the context ID of the requested Help topic.

Syntax

object.HelpContext [ = value ]

The parts of the HelpContext property syntax are described in the following table.

Part | Description
object | An object expression that evaluates to an object.
value | A string expression specifying the context ID of the requested Help topic.

Remarks

Use this property with the HelpCommand property to specify the Help topic to be displayed.

Data Type

String


HelpFile

Specifies the path and filename of a Windows Help file used by your application to display Help or online documentation.

Syntax

object.HelpFile [ = filename ]

The parts of the HelpFile property syntax are described in the following table.

Part | Description
object | An object expression that evaluates to an object.
filename | A string expression specifying the path and filename of the Windows Help file for your application.

Remarks

To build a Help file, see Pocket Help for Windows CE.


HideColumnHeaders

Returns or sets whether ColumnHeader objects in a ListView control are hidden in Report view.

Syntax

object.HideColumnHeaders [= boolean]

The parts of the HideColumnHeaders property syntax are described in the following table.

Part | Description
object | An object expression that evaluates to a ListView control.
boolean | A Boolean expression that specifies if the column headers are visible in Report view, as described in Settings.

Settings

The settings for boolean are:

Setting | Description
True | The column headers are not visible.
False | (Default) The column headers are visible.

Remarks

The ListItem objects and any related subitems remain visible even if the HideColumnHeaders property is set to True.


HideSelection

Returns a value that determines whether selected text appears highlighted when a control loses the focus.

Syntax

object.HideSelection

The object placeholder represents an object expression that evaluates to an object.

Return Values

The HideSelection property return values are described in the following table.

Value | Description
True | (Default). Selected text does not appear highlighted when the control loses the focus.
False | Selected text appears highlighted when the control loses the focus.

Remarks

You can use this property to indicate which text is highlighted while another form or a dialog box has the focus—for example, in a spell-checking routine.


HighLight

Returns or sets a value that determines whether selected cells appear highlighted.

Syntax

object.HighLight [= value ]

The HighLight property syntax has these parts:

Part | Description
object | An object expression that evaluates to an object.
value | Integer or constant specifying when Grid should highlight selected cells, as described in Settings.

Settings

The settings for value are:

Value | Description
0 | Never highlight selected cells.
1 | Always highlight selected cells.
2 | Highlight selected cells when control has focus.

Remarks

When this property is set to zero and the user selects a range of cells, there is no visual cue that shows which cells are currently selected. When the property is set to 2 (With Focus), the highlight appears only when the control has focus.


hImageList

Returns a handle to an ImageList control.

Syntax

object.hImageList

The object placeholder represents an object expression that evaluates to an object.

Remarks

The operating environment identifies an ImageList control in an application by assigning it a handle, or hImageList. The hImageList property is used with the Tabstrip, Treeview, and Listview controls. Many ImageList-related API functions require the hImageList of the active window as an argument.

Note Because the value of this property can change while a program is running, never store the hImageList value in a variable.


HWnd

Returns a handle to a form or control.

Syntax

object.hWnd

The object placeholder represents an object expression that evaluates to an object.

Remarks

The Microsoft Windows CE operating environment identifies each form and control in an application by assigning it a handle, or hWnd. Many Windows operating environment functions require the hWnd of the active window as an argument.

Note Because the value of this property can change while a program is running, never store the hWnd value in a variable.


Icons, SmallIcons

Returns or sets the ImageList controls associated with the Icon and SmallIcon views in a ListView control.

Syntax

object.Icons [=hImageList]

object.SmallIcons [=hImageList]

The parts of the Icons and SmalIcons property syntaxes are described in the following table.

Part | Description
object | An object expression that evaluates to a ListView control.
hImageList | An object expression that evaluates to an hImageList property.


ImageHeight, ImageWidth

The ImageHeight property returns or sets the height of ListImage objects in an ImageList control.

The ImageWidth property returns or sets the width of ListImage objects in an ImageList control.

Syntax

object.ImageHeight

object.ImageWidth

The object placeholder represents an object expression that evaluates to an object.

Remarks

Both height and width are measured in pixels. All images in a ListImages collection have the same height and width properties.


ImageList

Returns or sets the ImageList control, if any, that is associated with another control.

Syntax

object.ImageList[ = hImagelist ]

The parts of the ImageList property syntax are described in the following table.

Part | Description
object | An object expression that evaluates to an object.
himagelist | An object expression that evaluates to an hImageList property.


InBufferCount

Returns the number of characters waiting in the receive buffer. This property is not available at design time.

Syntax

object.InBufferCount[ = value ]

The parts of the InBufferCount property syntax are described in the following table.

Part | Description
object | An object expression that evaluates to an object.
value | An integer expression specifying the number of characters waiting in the receive buffer.

Remarks

The InBufferCount property refers to the number of characters that have been received by the modem and are waiting in the receive buffer for you to take them out. You can clear the receive buffer by setting the InBufferCount property to 0.

Data Type

Integer


Indentation

Returns or sets the width of the indentation for a Treeview control. Each new child Node object is indented by this amount.

Syntax

object.Indentation[ = number ]

The parts of the Indentation property syntax are described in the following table.

Part | Description
object | An object expression that evaluates to an object.
number | An integer specifying the width that each child Node is indented.

Remarks

If you change the Indentation property at run-time, the TreeView is redrawn to reflect the new width. The property value cannot be negative.


InitDir

Returns or sets the initial file directory.

Syntax

object.InitDir[ = string ]

The parts of the InitDir property syntax are described in the following table.

Part | Description
object | An object expression that evaluates to an object.
string | An string expression specifying the initial file directory.

Remarks

This property is used to specify the initial directory for an Open or Save As dialog. If this property is not specified, the current directory is used.

Data Type

String


Index

Returns or sets the number that uniquely identifies an object in a collection.

Syntax

object.Index

The object placeholder is an object expression that evaluates to an .

Remarks

The Index property is set by default to the order of the creation of objects in a collection. The index for the first object in a collection will always be 1.

The value of the Index property of an object can change when objects in the collection are reordered, such as when you set the Sorted property to True. If you expect the Index property to change dynamically, it may be more useful to refer to objects in a collection by using the Key property.


Input

Returns and removes a stream of data from the receive buffer. This property is not available at design time and is read-only at run time.

Syntax

object.Input

The parts of the Input property syntax are described in the following table.

Part | Description
object | An object expression that evaluates to an object.

Remarks

The InputLen property determines the number of characters that are read by the Input property. Setting InputLen to 0 causes the Input property to read the entire contents of the receive buffer.

The InputMode property determines the type of data that is retrieved with the Input property. If InputMode is set to 0, then the Input property returns text data in a Variant. If InputMode is 1, then the Input property returns binary data in an array of bytes in a Variant.

Data Type

Variant


InputLen

Sets and returns the number of characters the Input property reads from the receive buffer.

Syntax

object.InputLen [ = value ]

The parts of the InputLen property syntax are described in the following table.

Part | Description
object | An object expression that evaluates to an object.
value | An integer expression specifying the number of characters the Input property reads from the receive buffer.

Remarks

The default value for the InputLen property is 0. Setting InputLen to 0 causes the Comm control to read the entire contents of the receive buffer when the Input property is used.

If InputLen characters are not available in the receive buffer, the Input property returns a zero-length string (""). The user can optionally check the InBufferCount property to determine if the required number of characters are present before using Input.

This property is useful when reading data from a machine whose output is formatted in fixed-length blocks of data.

Data Type

Integer


InputMode

Sets or returns the type of data retrieved by the Input property.

Syntax

object.InputMode [ = value ]

The parts of the InputMode property syntax are described in the following table.

Part | Description
object | An object expression that evaluates to an object.
value | A value or constant that specifies the input mode, as described in Settings.

Settings

The settings for value are described in the following table.

Value | Description
0 | (Default) Data is retrieved through the Input property as text.
1 | Data is retrieved through the Input property as binary data.

Remarks

The InputMode property determines how data will be retrieved through the Input property. The data will either be retrieved as string or as binary data in a byte array.

Use 0 for data that uses the ANSI character set. Use 1 for all other data such as data that has embedded control characters, null characters, etc.


IntegralHeight

Returns or sets a value indicating if the control displays partial items. Read-only at run time.

Syntax

object.IntegralHeight [= value ]

The parts of the IntegralHeight property syntax are described in the following table.

Part | Description
object | An object expression that evaluates to an object.
value | A Boolean expression that determines whether the list is resized, as described in Settings.

Settings

The settings for value are described in the following table.

Setting | Description
True | (Default). The list resizes itself to display only complete items.
False | The list does not resize itself, even if the item is too tall to display completely.

Data Type

Boolean


Interval

Returns or sets the number of milliseconds between calls to a Timer control's Timer event.

Syntax

object.Interval [= milliseconds]

The parts of the Interval property syntax are described in the following table.

Part | Description
object | An object expression that evaluates to an object.
milliseconds | A numeric expression specifying the number of milliseconds, as described in Settings.

Settings

The settings for milliseconds are described in the following table.

Setting | Description
0 | (Default). Disables a Timer control.
1 to 65,535 | Sets an interval (in milliseconds) that takes effect when a Timer control's Enabled property is set to True. For example, a value of 10,000 milliseconds equals 10 seconds. The maximum, 65,535 milliseconds, is equivalent to just over 1 minute.

Remarks

You can set a Timer control's Interval property at design time or run time. When using the Interval property, remember:

  • The Timer control's Enabled property determines whether the control responds to the passage of time. Set Enabled to False to turn a Timer control off, and to True to turn it on. When a Timer control is enabled, its countdown always starts from the value of its Interval property setting.
  • Create a Timer event procedure to tell Visual Basic what to do each time the Interval has passed.


Italic

Returns or sets the font style of the Font object to either italic or non-italic.

Syntax

object.Italic [= boolean]

The parts of the Italic property syntax are described in the following table.

Part | Description
object | An object expression that evaluates to an object.
boolean | A Boolean expression specifying the font style as described in Settings.

Settings

The settings for boolean are described in the following table.

Setting | Description
True | Turns on italic formatting.
False | (Default). Turns off italic formatting.

Remarks

The Font object is not directly available at design time. Instead, set the Italic property by selecting a control's Font property in the Properties window and clicking the Properties button. In the Font Style box of the Font dialog box, select either Italic or Bold Italic. At run time, however, set Italic directly by specifying its setting for the Font object.


ItemData

Returns or sets a specific number for each item in a ComboBox or ListBox control.

Syntax

object.ItemData(index) [= number]

The parts of the ItemData property syntax are described in the following table.

Part | Description
object | An object expression that evaluates to an object.
index | The number of a specific item in the object.
number | The number to be associated with the specified item.

Remarks

The ItemData property is an array of long integer values with the same number of items as a control's List property. You can use the numbers associated with each item to identify the items. For example, you can use an employee's identification number to identify each employee name in a ListBox control. When you fill the ListBox, also fill the corresponding elements in the ItemData array with the employee numbers.

The ItemData property is often used as an index for an array of data structures associated with items in a ListBox control.

Note When you insert an item into a list with the AddItem method, an item is automatically inserted in the ItemData array as well. However, the value is not reinitialized to zero; it retains the value that was in that position before you added the item to the list. When you use the ItemData property, be sure to set its value when adding new items to a list.


KeyPreview

Returns or sets a value that determines whether keyboard events for forms are invoked before keyboard events for controls. The keyboard events are KeyDown, KeyUp, and KeyPress.

Syntax

object.KeyPreview [= boolean]

The parts of the KeyPreview property syntax are described in the following table.

Part | Description
object | An object expression that evaluates to an object.
boolean | A Boolean expression that specifies how events are received, as described in Settings.

Settings

The settings for boolean are described in the following table.

Setting | Description
True | The form receives keyboard events first and then the active control.
False | (Default) The active control receives keyboard events; the form does not.

Remarks

You can use this property to create a keyboard-handling procedure for a form. For example, when an application uses function keys, you'll want to process the keystrokes at the form level rather than writing code for each control that might receive keystroke events.

If a form has no visible and enabled controls, it automatically receives all keyboard events.

To handle keyboard events only at the form level and not allow controls to receive keyboard events, set KeyAscii to 0 in the form's KeyPress event, and set KeyCode to 0 in the form's KeyDown event.

Note Some controls intercept keyboard events so that the form cannot receive them. Examples include the ENTER key when focus is on a CommandButton control and arrow keys when focus is on a ListBox control.


LabelEdit

Returns or sets a value that determines if a user can edit labels of Node objects in a ListView or TreeView control.

Syntax

object.LabelEdit[ = integer ]

The parts of the LabelEdit property syntax are described in the following table.

Part | Description
object | An object expression that evaluates to an object.
integer | An integer that determines whether the label of a Node object can be edited, as specified in Settings.

Settings

The settings for integer are described in the following table.

Value | Description
0 | (Default) Automatic. The BeforelabelEdit event is generated when the user clicks the label of a selected node.
1 | Manual The BeforelabelEdit event is generated only when the StartLabelEdit method is invoked.

Remarks

Label editing of an object is initiated when a selected object is clicked (if the LabelEdit property is set to Automatic). That is, the first click on an object will select it; a second (single) click on the object will initiate the label editing operation.

The LabelEdit property, in combination with the StartLabelEdit method, allows you to programmatically determine when and which labels can be edited. When the LabelEdit property is set to 1, no label can be edited unless the StartLabelEdit method is invoked.


LabelWrap

Returns or sets a value that determines whether or not labels are wrapped when a ListView control is in Icon view.

Syntax

object.LabelWrap [= boolean]

The parts of the LabelWrap property syntax are described in the following table.

Part | Description
object | An object expression that evaluates to a ListView control.
boolean | A Boolean expression specifying if the labels wrap, as described in Settings.

Settings

The settings for boolean are described in the following table.

Setting | Description
True | (Default) The labels wrap.
False | The labels don't wrap.


LargeChange, SmallChange

The LargeChange property returns or sets the amount of change to the Value property setting in a scroll bar control (HScrollBar or VScrollBar) when the user clicks the area between the scroll box and scroll arrow.

The SmallChange property returns or sets the amount of change to the Value property setting in a scroll bar control when the user clicks a scroll arrow.

Syntax

object.LargeChange [= number]
object.SmallChange [= number]

The parts of the LargeChange and SmallChange property syntaxes are described in the following table.

Part | Description
object | An object expression that evaluates to an object.
number | An integer that specifies the amount of change to the Value property.

Remarks

For both properties, you can specify an integer between 1 and 32,767, inclusive. By default, each property is set to 1.

The Microsoft Windows CE operating environment automatically sets proportional scrolling increments for scroll bars, ComboBox controls, and ListBox controls based on the amount of data in the object. For the HScrollBar and VScrollBar controls, however, you must specify these increments. Use LargeChange and SmallChange to set scrolling increments appropriate to how the scroll bar is being used.

Typically, you set LargeChange and SmallChange at design time. You can also reset them in code at run time when the scrolling increment must change dynamically.

Note You set the maximum and minimum ranges of the HScrollBar and VScrollBar controls with the Max and Min properties.


Left

The Left property returns or sets the distance between the internal left edge of an object and the left edge of its container. The Top property returns or sets the distance between the internal top edge of an object and the top edge of its container.

Syntax

object.Left [= value]

object.Top [= value]

The parts of the Left and Top property syntaxes are described in the following table.

Part | Description
object | An object expression that evaluates to an object.
value | A numeric expression specifying distance.

Remarks

For a form, the Left and Top properties are always expressed in twips; for a control, they are measured in units depending on the coordinate system of its container. The values for these properties change as the object is moved by the user or by code. For the CommonDialog and Timer controls, these properties are not available at run time.

For either property, you can specify a single-precision number.

Use the Left, Top, Height, and Width properties for operations based on an object's external dimensions, such as moving or resizing. Use the ScaleLeft, ScaleTop, ScaleHeight, and ScaleWidth properties for operations based on an object's internal dimensions, such as drawing or moving objects that are contained within the object. The scale-related properties apply only to PictureBox controls and the Form and Printer object.


Left (ActiveX)

The Left property returns or sets the distance between the internal left edge of an object and the left edge of its container. The Top property returns or sets the distance between the internal top edge of an object and the top edge of its container.

Syntax

object.Left [= value]

object.Top [= value]

The parts of the Left and Top property syntaxes are described in the following table.

Part | Description
object | An object expression that evaluates to an object.
value | A numeric expression specifying distance.

Remarks

For a control the Left and Top properties are always measured in units depending on the coordinate system of its container. The values for these properties change as the object is moved by the user or by code.

For either property, you can specify a single-precision number.

Use the Left, Top, Height, and Width properties for operations based on an object's external dimensions, such as moving or resizing.


LeftCol

Returns or sets the left-most visible column (other than a fixed column) in the Grid control. Not available at design time.

Syntax

object.LeftCol [= value ]

The LeftCol property syntax has these parts:

Part | Description
object | An object expression that evaluates to an object.
value | Integer. A numeric expression specifying the left-most column.

Remarks

You can use this property in code to scroll Grid programmatically. Use the TopRow property to determine the topmost visible row in the Grid.


LegalCopyright

Returns or sets a string value containing legal copyright information about the running application. Read-only at run time.

Syntax

object.LegalCopyright

The object placeholder represents an object expression that evaluates to an object.

Remarks

You can set this property at design time in the Type box in the Make tab of the Project Properties dialog box.


LegalTradeMarks

Returns or sets a string value containing legal trademark information about the running application. Read-only at run time.

Syntax

object.LegalTrademarks

The object placeholder represents an object expression that evaluates to an object.

Remarks

You can set this property at design time in the Type box in the Make tab of the Project Properties dialog box.


ListItems

Returns a reference to a collection of ListItem objects in a ListView control.

Syntax

object. ListItems

The object placeholder represents an object expression that evaluates to a ListView control.

Remarks

ListItem obects can be manipulated using the standard collection methods. Each ListItem in the collection can be accessed by its unique Key, which you create and store in the Key property.

You can also retrieve ListItem objects by their display position using the Index property.


LineStyle

Returns or sets the style of lines displayed between Node objects.

Syntax

object.LineStyle[ = number ]

The parts of the LineStyle property syntax are described in the following table.

Part | Description
object | An object expression that evaluates to an object.
number | A value or constant that specifies the line style as specified in Settings.

Settings

The settings for number are described in the following table.

Value | Description
0 | (Default) Tree lines. Displays lines between Node siblings and their parent Node.
1 | Root lines. In addition to displaying lines between Node siblings and their parent Node, also displays lines between the root nodes.

Remarks

You must set the Style property to a style that includes tree lines.


List

Returns or sets the items contained in a control's list portion. The list is a string array in which each element is a list item. Available at design time for ListBox and ComboBox controls through the property browser; read/write at run time for ComboBox and ListBox controls.

Syntax

object.List(index) [= string]

The parts of the List property syntax are described in the following table.

Part | Description
object | An object expression that evaluates to an object.
index | The number of a specific item in the list.
string | A string expression specifying the list item.

Remarks

Use this property to access list items.

For all controls, the index of the first item is 0 and the index of the last item is ListCount–1.

Initially, ComboBox and ListBox controls contain an empty list. For the file-system controls, the list is based on conditions that exist when the control is created at run time:

The List property works in conjunction with the ListCount and ListIndex properties.

Note To specify items you want to display in a ComboBox or ListBox control, use the AddItem method. To remove items, use the RemoveItem method. To keep items in alphabetic order, set the control's Sorted property to True before adding items to the list.


ListCount

Returns the number of items in the list portion of a control.

Syntax

object.ListCount

The object placeholder represents an object expression that evaluates to an object.

Remarks

ListCount provides specific information for each control, as described in the following table.

Control | Information
ComboBox, ListBox | Number of items in the list.

If no item is selected, the ListIndex property value is –1. The first item in the list is ListIndex = 0, and ListCount is always one more than the largest ListIndex value.


ListIndex

Returns or sets the index of the currently selected item in the control. Not available at design time.

Syntax

object.ListIndex [= index]

The parts of the ListIndex property syntax are described in the following table.

Part | Description
object | An object expression that evaluates to an object.
index | A numeric expression specifying the index of the current item, as described in Settings.

Settings

The settings for index are described in the following table.

Setting | Description
–1 | (Default for ComboBox). Indicates no item is currently selected. For a ComboBox control, indicates the user has entered new text into the text box portion.
n | (Default for ListBox controls). A number indicating the index of the currently selected item.

Remarks

The expression List(List1.ListIndex) returns the string for the currently selected item.

The first item in the list is ListIndex = 0, and ListCount is always one more than the largest ListIndex value.

For a control in which users can make multiple selections, this property's behavior depends on the number of items selected. If only one item is selected, ListIndex returns the index of that item. In a multiple selection, ListIndex returns the index of the item contained within the focus rectangle, whether or not that item is actually selected.


Loc

Returns a Long integer specifying the current read/write position. With files opened using Random mode, Loc returns the number of the last record read or written. When opening files with all other modes, Loc returns the position of the last byte read or written.

Syntax

file.Loc


LocalHostName

Returns a string containing the local machine name. Returns the local machine name. Read-only, and unavailable at design time.

Syntax

object.LocalHostName

Return Value

String


LocalIP

Returns the IP address of the local machine in the IP address dotted string format (xxx.xxx.xxx.xxx).Read-only and unavailable at design time.

Syntax

object.LocalIP

Data Type

String


LocalPort

Returns or sets the local port to use. Returns a long with port number in local machine byte-order. Read/Write and available at design time.

  • For the client, this designates the local port from which to send data. Specify port 0 if the application does not need a specific port, in which case, the control will select a random port. After a connection is established, this is the local port used for the TCP connection.
  • For the server, this is the local port to listen on. After invoking the Listen method, the property contains the actual port that has been selected.

Syntax

object.LocalPort = long

Data Type

Long


Locked

Returns or sets a value indicating whether a control can be edited.

Syntax

object.Locked [ = boolean]

The parts of the Locked property syntax are described in the following table.

Part | Description
object | An object expression that evaluates to an object.
boolean | A Boolean expression that specifies whether the control can be edited, as described in Settings.

Settings

The settings for boolean are described in the following table.

Setting | Description
True | TextBox control. You can scroll and highlight the text in the control, but you cannot edit it. The program can still modify the text by changing the Text property.
 | ComboBox object. You cannot type in the textbox.
False | TextBox control. You can edit the text in the control.
 | ComboBox object. You can type in the textbox and drop down its list.

Remarks

For the ComboBox control, when Locked is set to True, the user cannot change any data, but can highlight data in the text box and copy it. This property does not affect programmatic access to the ComboBox.


LOF

Returns a Long representing the size, in bytes, of the file

Syntax

file.LOF


Major

Returns or sets the major release number of the project. Read-only at run time.

Syntax

object.Major

The object placeholder represents an object expression that evaluates to an object.

Remarks

The value of the Major property is in the range from 0 to 9999.

This property provides version information about the running application.

You can set this property at design time in the Major box in the Make tab of the Project Properties dialog box.


Max, Min

Returns or sets the smallest and largest font sizes displayed in the Size list box of the Font Common Dialog.

The Max property also returns or sets a scroll bar position's maximum Value property setting when the scroll box is in its bottom or rightmost position.

The Min property also returns or sets a scroll bar position's minimum Value property setting when the scroll box is in its top or leftmost position.

Syntax

object.Max [= value]

object.Min [= value]

The parts of the Max and Min property syntaxes are described in the following table.

Part | Description
object | An object expression that evaluates to an object.
value | A numeric expression specifying the maximum or minimum Value property setting, as described in Settings.

Settings

For each property, you can specify an integer between -32,768 and 32,767, inclusive. The default settings are:

  • Max — 32,767.
  • Min — 0.

Remarks

The Microsoft Windows CE operating environment automatically sets ranges for scroll bars proportional to the contents of forms, ComboBox controls, and ListBox controls. For a scroll bar (HScrollBar or VScrollBar) control, however, you must specify these ranges. Use Max and Min to set a range appropriate to how the scroll bar control is used — for example, as an input device or as an indicator of speed or quantity.

Typically, you set Max and Min at design time. You can also set them in code at run time if the scrolling range must change dynamically — for example, when adding records to a database that can be scrolled through. You set the maximum and minimum scrolling increments for a scroll bar control with the LargeChange and SmallChange properties.

Note If Max is set to less than Min, the maximum value is set at the leftmost or topmost position of a horizontal or vertical scroll bar, respectively.


MaxFileSize

Returns or sets the maximum size of the filename opened using the CommonDialog control.

Syntax

object.MaxFileSize [= value]

The parts of the MaxFileSize property syntax are described in the following table.

Part | Description
object | An object expression that evaluates to an object.
value | An integer specifying the maximum size of the filename in bytes. The range for this property is 1 – 32K. The default is 256.

Remarks

The MaxFileSize property allocates memory to store the actual names of the selected file or files.

Data Type

Integer


MaxLength

Returns or sets a value indicating whether there is a maximum number of characters that can be entered in the TextBox control and, if so, specifies the maximum number of characters that can be entered.

Note In DBCS (double-byte character set) systems, each character can take up to two bytes instead of only one, which limits the number of characters you can enter.

Syntax

object.MaxLength [= value]

The parts of the MaxLength property syntax are described in the following table.

Part | Description
object | An object expression that evaluates to an object.
value | An integer specifying the maximum number of characters a user can enter in a TextBox control. The default for the MaxLength property is 0. This indicates no maximum other than that created by memory constraints on the user's system for single-line TextBox controls and a maximum of approximately 32K for multiple-line TextBox controls. Any number greater than 0 indicates the maximum number of characters.

Remarks

Use the MaxLength property to limit the number of characters a user can enter in a TextBox.

If text that exceeds the MaxLength property setting is assigned to a TextBox from code, no error occurs; however, only the maximum number of characters are assigned to the Text property, and extra characters are truncated. Changing this property does not affect the current contents of a TextBox, but will affect any subsequent changes to the contents.


Minor

Returns or sets the minor release number of the project. Read-only at run time.

Syntax

object.Minor

The object placeholder represents an object expression that evaluates to an object.

Remarks

The value of the Minor property is in the range from 0 to 9999.

This property provides version information about the running application.

You can set this property at design time in the Minor box in the Make tab of the Project Properties dialog box.


Moveable

Returns or sets a value which specifies if the object can be moved.

Syntax

object.Moveable = boolean

The parts of the Moveable property syntax are described in the following table.

Part | Description
object | An object expression that evaluates to an object.
boolean | A Boolean expression that specifies if the object can be moved.

Settings

The settings for boolean are described in the following table.

Constant | Value | Description
True | 1 | The object can be moved.
False | 0 | The object cannot be moved.


MultiLine

Returns or sets a value indicating whether a TextBox control can accept and display multiple lines of text. Read-only at run time.

Syntax

object.MultiLine

The object placeholder represents an object expression that evaluates to an object.

Settings

The MultiLine property settings are described in the following table.

Setting | Description
True | Allows multiple lines of text.
False | (Default). Ignores carriage returns and restricts data to a single line.

Remarks

A multiple-line TextBox control wraps text as the user types text extending beyond the text box.

You can also add scroll bars to larger TextBox controls using the ScrollBars property. If no horizontal scroll bar is specified, the text in a multiple-line TextBox automatically wraps.

Note On a form with no default button, pressing ENTER in a multiple-line TextBox control moves the focus to the next line. If a default button exists, you must press CTRL+ENTER to move to the next line.


MultiRow

Returns or sets a value indicating whether a TabStrip control can display more than one row of tabs.

Syntax

object.MultiRow [= boolean]

The MultiRow property syntax has these parts:

Part | Description
object | An object expression that evaluates to an object.
boolean | A boolean expression that specifies whether the control has more than one row of tabs, as described in Settings.

Settings

The settings for boolean are:

Setting | Description
True | Allows more than one row of tabs.
False | Restricts tabs to a single row.

Remarks

The number of rows is automatically set by the width and number of the tabs. The number of rows can change if the control is resized, which ensures that the tab wraps to the next row. If MultiRow is set to False, and the last tab exceeds the width of the control, a horizontal spin control is added at the right end of the TabStrip control.

At design time, set the MultiRow property on the General tab in the Properties Page of the TabStrip control. At run time, use code like the following to set the MultiRow property:

'Allows more than one row of tabs in the TabStrip control.
TabStrip1.MultiRow = TRUE


MultiSelect

Returns or sets a value indicating whether a user can make multiple selections in a ListBox control and how the multiple selections can be made. Read-only at run time.

Syntax

object.MultiSelect

The object placeholder represents an object expression that evaluates to an object.

Settings

The MultiSelect property settings are described in the following table.

Setting | Description
0 | (Default). Multiple selection is not allowed.
1 | Simple multiple selection. A mouse click or pressing the SPACEBAR selects or deselects an item in the list. (Arrow keys move the focus.)
2 | Extended multiple selection. Pressing SHIFT and clicking the mouse or pressing SHIFT and one of the arrow keys (UP ARROW, DOWN ARROW, LEFT ARROW, and RIGHT ARROW) extends the selection from the previously selected item to the current item. Pressing CTRL and clicking the mouse selects or deselects an item in the list.


MultiSelect (ListView)

Returns or sets a value indicating whether a user can select multiple ListItems in the ListView control.

Syntax

object.MultiSelect [= boolean]

The parts of the MultiSelect property syntax are described in the following table.

Part | Description
object | An object expression that evaluates to a ListView conrol.
boolean | A value specifying the type of selection, as described in Settings.

Settings

The settings for boolean are described in the following table.

Setting | Description
True | Multiple selection. Pressing SHIFT and clicking the mouse or pressing SHIFT and one of the arrow Keys (UP ARROW, DOWN ARROW, LEFT ARROW, and RIGHT ARROW) extends the selection from the previously selected ListItem to the current ListItem. Pressing CTRL and clicking the mouse selects or deselects a ListItem in the list.
False | (Default) Selecting multiple ListItems isn't allowed.


Name

The Name property returns the name used in code to identify a form, control, or data access object, and returns or sets the name of a font object. Read-only at run time.

Syntax

object.Name

The object placeholder represents an object expression that evaluates to an object. If object is omitted, the form associated with the active form module is assumed to be object.

Remarks

The default name for new objects is the kind of object plus a unique integer.

An object's Name property must start with a letter and can be a maximum of 40 characters. It can include numbers and underline (_) characters but cannot include punctuation or spaces. Forms cannot have the same name as another public object such as Clipboard, Screen, or App. Although the Name property setting can be a keyword, property name, or the name of another object, this can create conflicts in your code.

Note Although Visual Basic often uses the Name property setting as the default value for the Caption, and Text properties, changing one of these properties does not affect the others.


Name (ADO)

Sets or returns name of a field. This property is read-only.

Return Values

Sets or returns a String that specifies a name.

Remarks

Because the PegDB does not store field names, a name is constructed using the high-order word of the PEGPROPID. Since ADO sql always creates these names as 0, 1, 2, … etc., it generally maps well to the Fields collection index.


NewIndex

Returns the index of the item most recently added to a ComboBox or ListBox control. Read-only at run time.

Syntax

object.NewIndex

The object placeholder represents an object expression that evaluates to an object.

Remarks

You can use this property with sorted lists when you need a list of values that correspond to each item in the ItemData property array. As you add an item in a sorted list, Visual Basic inserts the item in the list in alphabetic order. This property tells you where the item was inserted so that you can insert a corresponding value in the ItemData property at the same index.

The NewIndex property returns -1 if there are no items in the list or if an item has been deleted since the last item was added.


Nodes

Returns a reference to a collection of TreeView control Node objects.

Syntax

object.Nodes

The object placeholder represents an object expression that evaluates to an object.

Remarks

You can manipulate Node objects using standard collection methods (for example, the Add and Remove methods). You can access each element in the collection by its index, or by a unique key that you store in the Key property.


NullDiscard

Determines whether null characters are transferred from the port to the receive buffer.

Syntax

object.NullDiscard [ = value ]

The parts of the NullDiscard property syntax are described in the following table.

Part | Description
object | An object expression that evaluates to an object.
value | A Boolean expression that specifies whether null characters are transferred from the port to the receive buffer, as described in Settings

Settings

The settings for value are described in the following table.

Setting | Description
True | Null characters are not transferred from the port to the receive buffer.
False | (Default) Null characters are transferred from the port to the receive buffer.

Remarks

A null character is defined as ASCII character 0, Chr(0).

Data Type

Boolean


Number

Returns or sets a numeric value specifying an error. Number is the Err object's default property.

Syntax

object.Number [= errornumber]

The parts of the Number property syntax are described in the following table.

Part | Description
object | Always the Err object.
errornumber | An integer representing an error number.


Object

Returns a reference to a property or method of a control which has the same name as a property or method automatically extended to the control by Visual Basic.

Syntax

object.Object[.property | .method]

The Object property syntax has these parts:

Part | Description
property | Property of the control that is identical to the name of a Visual Basic-supplied property.
method | Method of the control that is identical to the name of a Visual Basic-supplied method.

Remarks

Visual Basic supplies some or all of a standard set of properties and methods to controls in a Visual Basic project. It is possible for a control or ActiveX component to define a property or method which has the same name as one of these standard properties or methods. When this occurs, Visual Basic automatically uses the property or method it supplies instead of the one with the same name defined in the control. The Object property allows you to bypass the Visual Basic-supplied property or method and use the identically named property or method defined in the control.

For example, the Tag property is a property supplied to all controls in a Visual Basic project. If a control in a project has the name ctlDemo, and you access the Tag property using this syntax:

ctlDemo.Tag


OutBufferCount

Returns the number of characters waiting in the transmit buffer. You can also use it to clear the transmit buffer. This property is not available at design time.

Syntax

object.OutBufferCount [ = value ]

The parts of the OutBufferCount property syntax are described in the following table.

Part | Description
object | An object expression that evaluates to an object.
value | An integer expression that specifies the number of characters waiting in the transmit buffer.

Remarks

You can clear the transmit buffer by setting the OutBufferCount property to 0.

Data Type

Integer


Output

Writes a stream of data to the transmit buffer. This property is not available at design time and is write-only at run time.

Syntax

object.Output [ = value ]

The parts of the Output property syntax are described in the following table.

Part | Description
object | An object expression that evaluates to an object.
value | A string of characters to write to the transmit buffer.

Remarks

The Output property can transmit text data or binary data. To send text data using the Output property, you must specify a Variant that contains a string. To send binary data, you must pass a Variant which contains a byte array to the Output property.

Normally, if you are sending an ANSI string to an application, you can send it as text data. If you have data that contains embedded control characters, null characters, etc., then you will want to pass it as binary data.

Data Type

Variant


Parent

The Parent object returns the form, object, or collection that contains the control. Returns the object or collection that contains another object or collection. Read-only.

Syntax

object.Parent

The object placeholder represents an object expression that evaluates to an object.

Remarks

Most objects have either a Parent property or a Collection property that points to the object's parent object in this object model. The Collection property is used if the parent object is a collection.

Use the Parent property to access the properties, methods, and controls of an object's parent object.

MsgBox Command1.Parent.Name = 4

The Parent property is useful in an application in which you pass objects as arguments. For example, you could pass a control variable to a general procedure in a module, and use the Parent property to access its parent form.


ParityReplace

Sets and returns the character that replaces an invalid character in the data stream when a parity error occurs.

Syntax

object.ParityReplace [ = value ]

The parts of the ParityReplace property syntax are described in the following table.

Part | Description
object | An object expression that evaluates to an object.
value | A string expression representing a character, as described in Remarks.

Remarks

The parity bit refers to a bit that is transmitted along with a specified number of data bits to provide a small amount of error checking. When you use a parity bit, the Comm control adds up all the bits that are set (having a value of 1) in the data, and tests the sum as being odd or even (according to the parity setting used when the port was opened).

By default, the control uses a question mark (?) character for replacing invalid characters. Setting ParityReplace to an empty string ("") disables replacement of the character where the parity error occurs. The OnComm event is still fired and the CommEvent property is set to 1009.

The ParityReplace character is used in a byte-oriented operation, and must be a single-byte character. You can specify any ANSI character code with a value from 0 to 255.

Data Type

String


PasswordChar

Returns or sets a value indicating whether the characters typed by a user or placeholder characters are displayed in a TextBox control; returns or sets the character used as a placeholder.

Syntax

object.PasswordChar [= value]

The parts of the PasswordChar property syntax are described in the following table.

Part | Description
object | An object expression that evaluates to an object.
value | A string expression specifying the placeholder character.

Remarks

Use this property to create a password field in a dialog box. Although you can use any character, most Windows-based applications use the asterisk (*) (Chr(42)).

This property does not affect the Text property; Text contains exactly what the user types or what was set from code. Set PasswordChar to a zero-length string (""), which is the default, to display the actual text.

You can assign any string to this property, but only the first character is significant; all others are ignored.

Note If the MultiLine Property is set to True, setting the PasswordChar property will have no effect.


Path

Returns or sets the current path. Not available at design time. For the App object, read-only at run time.

Syntax

object.Path [= pathname]

Part | Description
pathname | A string expression that evaluates to the path name.

Remarks

The value of the Path property is a string indicating a path.


PathSeparator

Returns or sets the delimiter character used for the path returned by the FullPath property.

Syntax

object.PathSeparator [= string]

The parts of the PathSeparator property syntax are described in the following table.

Part | Description
object | An object expression that evaluates to an object.
string | A string that determines the PathSeparator, usually a single character.

Remarks

The default character for the string is " \ ".


Picture

Returns or sets a graphic to be displayed in a control.

Syntax

object.Picture [= picture]

The parts of the Picture property syntaxes are described in the following table.

Part | Description
picture | A string expression specifying a file containing a graphic, as described in Settings.

Settings

The settings for picture are described in the following table.

Setting | Description
(None) | (Default) No picture.
Bitmap | Specifies a graphic. You can load the graphic from the Properties window at design time. At run time, you can also set this property using the file name of a bitmap.

Remarks

At run time, the Picture property can be set to any other Picture property. Images are always specified by file name.


PortOpen

Sets and returns the state of the communications port (open or closed). Not available at design time.

Syntax

object.PortOpen [ = value ]

The parts of the PortOpen property syntax are described in the following table.

Part | Description
object | An object expression that evaluates to an object.
value | A Boolean expression that specifies the state of the communications port.

Settings

The settings for value are described in the following table.

Setting | Description
True | Port is opened.
False | Port is closed.

Remarks

Setting the PortOpen property to True opens the port. Setting it to False closes the port and clears the receive and transmit buffers. The Comm control automatically closes the serial port when your application is terminated.

Make sure the CommPort property is set to a valid port number before opening the port. If the CommPort property is set to an invalid port number when you try to open the port, the Comm control generates error 68 (Device unavailable).

In addition, your serial port device must support the current values in the Settings property. If the Settings property contains communications settings that your hardware does not support, your hardware may not work correctly.

If either the DTREnable or the RTSEnable properties are set to True before the port is opened, the properties are set to False when the port is closed. Otherwise, the DTR and RTS lines remain in their previous state.

Data Type

Boolean


PrevInstance

Returns a value indicating whether a previous instance of an application is already running.

Syntax

object.PrevInstance

The object placeholder represents an object expression that evaluates to an object.

Remarks

You can use this property in a Load event procedure to specify whether a user is already running an instance of an application. Depending on the application, you might want only one instance running in the Microsoft Windows CE operating environment at a time.

Note The PrevInstance property always returns False in Windows CE.


ProductName

Returns or sets a string value containing the product name of the running application. Read-only at run time.

Syntax

object.ProductName

The object placeholder represents an object expression that evaluates to an object.

Remarks

You can set this property at design time in the Type box in the Make tab of the Project Properties dialog box.


Protocol

Returns or sets the protocol, either TCP or UDP, used by the Winsock control.

Syntax

object.Protocol [=protocol]

Settings

The settings for protocol are described in the following table.

Value | Description
0 | Default. TCP protocol.
2 | UDP protocol.

Return Value

Void.

Remarks

The control must be closed (using the Close method) before this property can be reset.


RecordCount

Returns a Long value that indicates the current number of records in a Recordset object.

Return Value

Reading the RecordCount property on a closed Recordset causes an error.

Remarks

This value is obtained from wNumRecords in the PEGDBASEINFO structure returned from a PegOidGetInfo call.


Redraw

Returns or sets a value that determines whether the Grid control should or not be automatically redrawn after each change.

Syntax

object.Redraw [= boolean ]

The Redraw property syntax has these parts:

Part | Description
object | An object expression that evaluates to an object.
boolean | The property is True by default.

Remarks

You can use this property in code to reduce flicker while making extensive updates to the contents of the Grid control.


RemoteHost

Returns or sets the remote machine to which a control sends or receives data. String value that can either be a host name, for example, "ftp.microsoft.com" or an IP address string in dotted format, such as "100.0.1.1".

Syntax

object.RemoteHost = string

The parts of the RemoteHost property syntax are described in the following table.

Part | Description
object | An object expression that evaluates to an object.
string | The name or address of the remote computer.

Data Type

String.

Remarks

At run time, changing this value has no effect until the next connection.


RemoteHostIP

Returns the IP address of the remote machine. Note that this value is only valid after the user has set the RemoteHost property. Read-only.

  • For Client Applications, after a connection has been estalished using the Connect method, this property contains the IP string of the remote machine.
  • For Server applications, after an incoming connection request (ConnectionRequest event), this property contains the IP string of the remote machine that initiated the connection.

Syntax

object.RemoteHostIP

Data Type

String


RemotePort

Returns or sets the remote port number to connect to.

Syntax

object.RemotePort = port

The parts of the RemotePort property syntax are described in the following table.

Part | Description
object | An object expression that evaluates to an object.
port | The port to connect to.

Data Type

Long


Revision

Returns or sets the revision version number of the project. Read-only at run time.

Syntax

object.Revision

The object placeholder represents an object expression that evaluates to an object.

Remarks

The value of the Revision property is in the range from 0 to 9999.

This property provides version information about the running application.

You can set this property at design time in the Revision box in the Make tab of the Project Properties dialog box.


RowHeight

Returns or sets the height of the specified row, in twips. Not available at design time.

Syntax

object.RowHeight( number )[= value ]

The RowHeight property syntax has these parts:

Part | Description
object | An object expression that evaluates to an object.
number | Integer. The number of the row in the Grid control, or -1 to set all rows at once.
value | Single. A numeric expression specifying the height of the row in twips.

Remarks

You can set RowHeight to zero to create invisible rows, or to –1 to reset the row height to its default value, which depends on the size of the current font.

RowHeight is independent of the form's scale mode.


RowHeightMin

Returns or sets the minimum row height for the entire control, in twips.

Syntax

object.RowHeightMin [= value ]

The RowHeightMin property syntax has these parts:

Part | Description
object | An object expression that evaluates to an object.
value | Single. A numeric expression specifying the minimum row height for Grid.

Remarks

Use this property if you wish to use small fonts but want the rows to be tall. Setting this property is sometimes easier than setting individual row heights with the RowHeight property.

RowHeight is independent of the form's scale mode.


RowIsVisible

Returns a Boolean value that indicates whether a specified row is currently visible.

Syntax

object.RowIsVisible( index )

The RowIsVisible property syntax has these parts:

Part | Description
object | An object expression that evaluates to an object.
index | Long. The number of the column. The value must be in the range of 0 to Cols property –1.

Return Values

The return values for the RowIsVisible property are:

Setting | Description
True | The specified row is currently visible.
False | The specified row is not currently visible.


RowPos

Returns the distance in twips between the upper-left corner of the control and the upper-left corner of a specified row.

Syntax

object.RowPos ( index )

The RowPos property syntax has these parts:

Part | Description
object | An object expression that evaluates to an object.
index | Long. The number of the column. The value must be in the range of 0 to Cols property –1.


RThreshold

Sets and returns the number of characters to receive before the Comm control sets the CommEvent property to comEvReceive and generates the OnComm event.

Syntax

object.Rthreshold [ = value ]

The parts of the Rthreshold property syntax are described in the following table.

Part | Description
object | An object expression that evaluates to an object.
value | An integer expression specifying the number of characters to receive before generating the OnComm event.

Remarks

Setting the RThreshold property to 0 (the default) disables generating the OnComm event when characters are received.

Setting RThreshold to 1, for example, causes the Comm control to generate the OnComm event every time a single character is placed in the receive buffer.

Data Type

Integer


RTSEnable

Determines whether to enable the Request To Send (RTS) line. Typically, the Request To Send signal that requests permission to transmit data is sent from a computer to its attached modem.

Syntax

object.RTSEnable[ = value ]

The parts of the RTSEnable property syntax are described in the following table.

Part | Description
object | An object expression that evaluates to an object.
value | An boolean expression specifying whether the Request To Send (RTS) line is enabled, as described in Settings.

Settings

The settings for value are described in the following table.

Setting | Description
True | Enables the Request To Send line.
False | (Default) Disables the Request To Send line.

Remarks

When RTSEnable is set to True, the Request To Send line is set to high (on) when the port is opened, and low (off) when the port is closed.

The Request To Send line is used in RTS/CTS hardware handshaking. The RTSEnable property allows you to manually poll the Request To Send line if you need to determine its state.

Data Type

Boolean


ScaleHeight

Return or set the number of units for the horizontal (ScaleWidth) and vertical (ScaleHeight) measurement of the interior of an object when using graphics methods or when positioning controls.

Syntax

object.ScaleHeight [= value]

object.ScaleWidth [= value]

The parts of the ScaleHeight and ScaleWidth property syntaxes are described in the following table.

Part | Description
object | An object expression that evaluates to an object.
value | A numeric expression specifying the horizontal or vertical measurement.

Remarks

You can use these properties to create a custom coordinate scale for drawing. For example, the statement ScaleHeight = 100 changes the units of measure of the actual interior height of the form. Instead of the height being n current units (twips, pixels, ...), the height will be 100 user-defined units. Therefore, a distance of 50 units is half the height/width of the object, and a distance of 101 units will be off the object by 1 unit.

Use the ScaleMode property to define a scale based on a standard unit of measurement, such as twips, points, pixels, characters, inches, millimeters, or centimeters.

Setting these properties to positive values makes coordinates increase from top to bottom and left to right. Setting them to negative values makes coordinates increase from bottom to top and right to left.

Using these properties and the related ScaleLeft and ScaleTop properties, you can set up a full coordinate system with both positive and negative coordinates. All four of these Scale properties interact with the ScaleMode property in the following ways:

  • Setting any other Scale property to any value automatically sets ScaleMode to 0. A ScaleMode of 0 is user-defined.
  • Setting ScaleMode to a number greater than 0 changes ScaleHeight and ScaleWidth to the new unit of measurement and sets ScaleLeft and ScaleTop to 0. In addition, the CurrentX and CurrentY settings change to reflect the new coordinates of the current point.

You can also use the Scale method to set the ScaleHeight, ScaleWidth, ScaleLeft, and ScaleTop properties in one statement.

Note The ScaleHeight and ScaleWidth properties are not the same as the Height and Width properties.


ScaleLeft

Return or set the horizontal (ScaleLeft) and vertical (ScaleTop) coordinates for the left and top edges of an object when using graphics methods or when positioning controls.

Syntax

object.ScaleLeft [= value]

object.ScaleTop [= value]

The parts of the ScaleLeft and ScaleTop property syntaxes are described in the following table.

Part | Description
object | An object expression that evaluates to an object.
value | A numeric expression specifying the horizontal or vertical coordinate. The default is 0.

Remarks

Using these properties and the related ScaleHeight and ScaleWidth properties, you can set up a full coordinate system with both positive and negative coordinates. These four Scale properties interact with the ScaleMode property in the following ways:

  • Setting any other Scale property to any value automatically sets ScaleMode to 0. A ScaleMode of 0 is user-defined.
  • Setting the ScaleMode property to a number greater than 0 changes ScaleHeight and ScaleWidth to the new unit of measurement and sets ScaleLeft and ScaleTop to 0. The CurrentX and CurrentY property settings change to reflect the new coordinates of the current point.

You can also use the Scale method to set the ScaleHeight, ScaleWidth, ScaleLeft, and ScaleTop properties in one statement.

Note The ScaleLeft and ScaleTop properties are not the same as the Left and Top properties.


ScaleMode

Returns or sets a value indicating the unit of measurement for coordinates of an object when using graphics methods or when positioning controls.

Syntax

object.ScaleMode [= value]

The parts of the ScaleMode property syntax are described in the following table.

Part | Description
object | An object expression that evaluates to an object.
value | An integer specifying the unit of measurement, as described in Settings.

Settings

The settings for value are shown in the following table.

Constant | Setting | Description
vbUser | 0 | Indicates that one or more of the ScaleHeight, ScaleWidth, ScaleLeft, and ScaleTop properties are set to custom values.
vbTwips | 1 | (Default) Twip (1440 twips per logical inch; 567 twips per logical centimeter).
vbPoints | 2 | Point (72 points per logical inch).
vbPixels | 3 | Pixel (smallest unit of monitor resolution).
vbCharacters | 4 | Character (horizontal = 120 twips per unit; vertical = 240 twips per unit).
vbInches | 5 | Inch.
vbMillimeters | 6 | Millimeter.
vbCentimeters | 7 | Centimeter.

Remarks

Using the related ScaleHeight, ScaleWidth, ScaleLeft, and ScaleTop properties, you can create a custom coordinate system with both positive and negative coordinates. These four Scale properties interact with the ScaleMode property in the following ways:

  • Setting the value of any other Scale property to any value automatically sets ScaleMode to 0. A ScaleMode of 0 is user-defined.
  • Setting the ScaleMode property to a number greater than 0 changes ScaleHeight and ScaleWidth to the new unit of measurement and sets ScaleLeft and ScaleTop to 0. The CurrentX and CurrentY property settings change to reflect the new coordinates.


ScaleTop

Return or set the horizontal (ScaleLeft) and vertical (ScaleTop) coordinates for the left and top edges of an object when using graphics methods or when positioning controls.

Syntax

object.ScaleLeft [= value]

object.ScaleTop [= value]

The parts of the ScaleLeft and ScaleTop property syntaxes are described in the following table.

Part | Description
object | An object expression that evaluates to an object.
value | A numeric expression specifying the horizontal or vertical coordinate. The default is 0.

Remarks

Using these properties and the related ScaleHeight and ScaleWidth properties, you can set up a full coordinate system with both positive and negative coordinates. These four Scale properties interact with the ScaleMode property in the following ways:

  • Setting any other Scale property to any value automatically sets ScaleMode to 0. A ScaleMode of 0 is user-defined.
  • Setting the ScaleMode property to a number greater than 0 changes ScaleHeight and ScaleWidth to the new unit of measurement and sets ScaleLeft and ScaleTop to 0. The CurrentX and CurrentY property settings change to reflect the new coordinates of the current point.

You can also use the Scale method to set the ScaleHeight, ScaleWidth, ScaleLeft, and ScaleTop properties in one statement.

Note The ScaleLeft and ScaleTop properties are not the same as the Left and Top properties.


ScaleWidth

Return or set the number of units for the horizontal (ScaleWidth) and vertical (ScaleHeight) measurement of the interior of an object when using graphics methods or when positioning controls.

Syntax

object.ScaleHeight [= value]

object.ScaleWidth [= value]

The parts of the ScaleHeight and ScaleWidth property syntaxes are described in the following table.

Part | Description
object | An object expression that evaluates to an object.
value | A numeric expression specifying the horizontal or vertical measurement.

Remarks

You can use these properties to create a custom coordinate scale for drawing. For example, the statement ScaleHeight = 100 changes the units of measure of the actual interior height of the form. Instead of the height being n current units (twips, pixels, ...), the height will be 100 user-defined units. Therefore, a distance of 50 units is half the height/width of the object, and a distance of 101 units will be off the object by 1 unit.

Use the ScaleMode property to define a scale based on a standard unit of measurement, such as twips, points, pixels, characters, inches, millimeters, or centimeters.

Setting these properties to positive values makes coordinates increase from top to bottom and left to right. Setting them to negative values makes coordinates increase from bottom to top and right to left.

Using these properties and the related ScaleLeft and ScaleTop properties, you can set up a full coordinate system with both positive and negative coordinates. All four of these Scale properties interact with the ScaleMode property in the following ways:

  • Setting any other Scale property to any value automatically sets ScaleMode to 0. A ScaleMode of 0 is user-defined.
  • Setting ScaleMode to a number greater than 0 changes ScaleHeight and ScaleWidth to the new unit of measurement and sets ScaleLeft and ScaleTop to 0. In addition, the CurrentX and CurrentY settings change to reflect the new coordinates of the current point.

You can also use the Scale method to set the ScaleHeight, ScaleWidth, ScaleLeft, and ScaleTop properties in one statement.

Note The ScaleHeight and ScaleWidth properties are not the same as the Height and Width properties.


ScrollBars

Returns or sets a value indicating whether an object has horizontal or vertical scroll bars. Read-only at run time.

Syntax

object.ScrollBars

The object placeholder represents an object expression that evaluates to an object.

Settings

For a TextBox control, the ScrollBars property settings are described in the following table.

Constant | Setting | Description
vbSBNone | 0 | (Default). None
vbHorizontal | 1 | Horizontal
vbVertical | 2 | Vertical
vbBoth | 3 | Both

Remarks

For a TextBox control with setting 1 (Horizontal), 2 (Vertical), or 3 (Both), you must set the MultiLine property to True.

At run time, the Microsoft Windows CE operating environment automatically implements a standard keyboard interface to allow navigation in TextBox controls with the arrow keys (UP ARROW, DOWN ARROW, LEFT ARROW, and RIGHT ARROW), the HOME and END keys, and so on.

Scroll bars are displayed on an object only if its contents extend beyond the object's borders. A vertical scroll bar appears on a TextBox control when it cannot display all of its lines of text. If ScrollBars is set to False, the object will not have scroll bars, regardless of its contents.


ScrollBars (Grid)

Returns or sets a value that determines whether a Grid has horizontal and/or vertical scroll bars.

Syntax

object.ScrollBars [= value ]

The ScrollBars property syntax has these parts:

Part | Description
object | An object expression that evaluates to an object.
value | Integer or constant specifying the type of scrollbars, as described in Settings.

Settings

The settings for value are:

Value | Description
0 | None
1 | Horizontal
2 | Vertical
3 | Both

Remarks

Scroll bars appear on a Grid only if its contents extend beyond the Grid control's borders. For example, a vertical scroll bar appears when Grid can't display all of its rows. If ScrollBars is set to False, Grid will not have scroll bars, regardless of its contents.

Note that if Grid has no scroll bars in either direction, it will not allow any scrolling in that direction, even if the user uses the keyboard to select a cell that is off the visible area of the control.


ScrollTrack

Returns or sets a value that determines whether Grid should scroll its contents while the user moves the scroll box along the scroll bars.

Syntax

object.ScrollTrack [= boolean ]

The ScrollTrack property syntax has these parts:

Part | Description
object | An object expression that evaluates to an object.
boolean | This property is False by default.

Remarks

This property should normally be set to False to avoid excessive scrolling and flickering. Set it to True only if you want to emulate other controls that have this behavior, or when you want to view rows and columns as they are being scrolled.


Seek

Gets or sets the next position that is read or written. Zero or negative Seek causes an error.

Syntax

file.Seek

Example

File.Seek= 5


SelCount

Returns the number of selected items in a ListBox control.

Syntax

object.SelCount

The object placeholder represents an object expression that evaluates to an object.

Remarks

The SelCount property returns 0 if no items are selected. Otherwise, it returns the number of list items currently selected. This property is particularly useful when users can make multiple selections.


Selected

Returns or sets the selection status of an item in a ListBox control. This property is an array of Boolean values with the same number of items as the List property. Not available at design time.

Syntax

object.Selected(index) [= boolean]

The parts of the Selected property syntax are described in the following table.

Part | Description
object | An object expression that evaluates to an object.
index | The index number of the item in the control.
boolean | A Boolean expression specifying whether the item is selected, as described in Settings.

Settings

The settings for boolean are described in the following table.

Setting | Description
True | The item is selected.
False | (Default). The item is not selected.

Remarks

This property is particularly useful when users can make multiple selections. You can quickly check which items in a list are selected. You can also use this property to select or deselect items in a list from code.

If the MultiSelect property is set to 0, you can use the ListIndex property to get the index of the selected item. However, in a multiple selection, the ListIndex property returns the index of the item contained within the focus rectangle, whether or not the item is actually selected.

If a ListBox control's Style property is set to 1 (check boxes), the Selected property returns True only for those items whose check boxes are selected. The Selected property will not return True for those items which are only highlighted.


SelectedItem

Returns a reference to a selected ListItem, Node, or Tab object.

Syntax

object.SelectedItem

The object placeholder represents an object expression that evaluates to an object.

Remarks

The SelectedItem property returns a reference to an object that can be used to set properties and invoke methods on the selected object. This property is typically used to return a reference to a ListItem, Node, or Tab or object that the user has clicked or selected. With this reference, you can validate an object before allowing any further action, as demonstrated in the following code:

Command1_Click()
    ' If the selected object is not the root, then remove the Node.
    If TreeView1.SelectedItem.Index <> 1 Then
        Treeview1.Nodes.Remove TreeView1.SelectedItem.Index
    End If
End Sub

To programmatically select a Node object, use the Set statement with the SelectedItem property, as follows:

Set TreeView1.SelectedItem = TreeView1.Nodes(1)

To programmatically select a ListItem object, use the Set statement with the SelectedItem property, as follows:

Set ListView1.SelectedItem = ListView1.ListItems(1)


SelectionMode

Returns or sets a value that determines whether a Grid should allow regular cell selection, selection by rows, or selection by columns.

Syntax

object.SelectionMode [= number ]

The SelectionMode property syntax has these parts:

Part | Description
object | An object expression that evaluates to an object.
number | Integer or constant specifying the selection mode, as described in Settings.

Settings

The settings for number are:

Value | Description
0 | Free. Allows selections to be made normally, spreadsheet-style.
1 | By Row. Forces selections to span entire rows, as in a multi-column list-box or record-based display.
2 | By Column. Forces selections to span entire columns, as if selecting ranges for a chart or fields for sorting.


SelLength, SelStart, SelText

The SelLength property returns or sets the number of characters selected.

The SelStart property returns or sets the starting point of text selected; indicates the position of the insertion point if no text is selected.

The SelText property returns or sets the string containing the currently selected text; consists of a zero-length string ("") if no characters are selected.

Note These properties are not available at design time.

Syntax

object.SelLength [= number]

object.SelStart [= index]

object.SelText [= value]

The parts of the SelLength, SelStart, and SelText property syntaxes are described in the following table.

Part | Description
object | An object expression that evaluates to an object.
number | A numeric expression specifying the number of characters selected. For SelLength and SelStart, the valid range of settings is 0 to text length — the total number of characters in the edit area of a ComboBox or TextBox control.
index | A numeric expression specifying the starting point of the selected text, as described in Settings.
value | A string expression containing the selected text.

Remarks

Use these properties for tasks such as setting the insertion point, establishing an insertion range, selecting substrings in a control, or clearing text. Used in conjunction with the Clipboard object, these properties are useful for copy, cut, and paste operations.

When working with these properties, remember that:

  • Setting SelLength less than 0 causes a run-time error.
  • Setting SelStart greater than the text length sets the property to the existing text length; changing SelStart changes the selection to an insertion point and sets SelLength to 0.
  • Setting SelText to a new value sets SelLength to 0 and replaces the selected text with the new string.


ServiceName

Sets or returns the name of the service for an IRDA connection.

Syntax:

object.ServiceName [= string]


Settings

Sets and returns the baud rate, parity, data bit, and stop bit parameters.

Syntax

object.Settings [ = value ]

The parts of the Settings property syntax are described in the following table.

Part | Description
object | An object expression that evaluates to an object.
value | An string expression representing the communications port settings, as described below.

Remarks

If value is not valid when the port is opened, the Comm control generates error 380 (Invalid property value).

Value is composed of four settings and has the following format:

"BBBB,P,D,S"

Where BBBB is the baud rate, P is the parity, D is the number of data bits, and S is the number of stop bits. The default value of value is:

"9600,N,8,1"

The following table lists the valid baud rates.

Setting
110
300
600
1200
2400
9600 (Default)
14400
19200
28800
38400 (reserved)
56000 (reserved)
128000 (reserved)
256000 (reserved)

The following table describes the valid parity values.

Setting | Description
E | Even
M | Mark
N | (Default)
None |
O | Odd
S | Space

The following table lists the valid data bit values.

Setting
4
5
6
7
8

The following table lists the valid stop bit values.

Setting
1 (Default)
1.5
2

Data Type

String


Shape

Returns or sets a value indicating the appearance of a Shape control.

Syntax

object.Shape [= value]

The parts of the Shape property syntax are described in the following table.

Part | Description
object | An object expression that evaluates to an object.
value | An integer specifying the control's appearance, as described in Settings.

Settings

The settings for value are described in the following table.

Constant | Setting | Description
vbShapeRectangle | 0 | (Default) Rectangle
vbShapeSquare | 1 | Square
vbShapeOval | 2 | Oval
vbShapeCircle | 3 | Circle
vbShapeRoundedRectangle | 4 | Rounded Rectangle
vbShapeRoundedSquare | 5 | Rounded Square


ShowInTaskBar

Returns or sets a value that determines whether a Form object appears in the Windows CE taskbar. Read-only at run time.

Syntax

object.ShowInTaskbar

The object placeholder represents an object expression that evaluates to an object.

Settings

The settings for the ShowInTaskbar property are described in the following table.

Setting | Description
True | (Default) The Form object appears in the taskbar.
False | The Form object does not appear in the taskbar.

Remarks

Use the ShowInTaskbar property to keep dialog boxes in your application from appearing in the taskbar.

The default value for the ShowInTaskbar property assumes the default setting for the BorderStyle property of the Form object (Sizable). Changing the BorderStyle property may change the setting of the ShowInTaskbar property.


Size

Returns or sets the font size used in the Font object.

Syntax

object.Size [= number]

The parts of the Size property syntax are described in the following table.

Part | Description
object | An object expression that evaluates to an object.
number | A numeric expression specifying the size of the font in points.

Remarks

Use this property to format text in the font size you want. The default font size is determined by the operating system. To change the default, specify the size of the font in points. The maximum value for the Size property is 2048 points.

The Font object is not directly available at design time. Instead, set the Size property by selecting a control's Font property in the Properties window and clicking the Properties button. In the Size box of the Font dialog box, select the size you want. At run time, however, set Size directly by specifying its setting for the Font object.


SocketHandle

Returns a Long value that corresponds to the socket handle that the control uses to communicate with the Winsock layer. Read-only, and unavailable at design time.

Syntax

object.SocketHandle

Data Type

Long

Remarks

This property was designed to be passed to Winsock APIs.


Sort

Sets a value that sorts selected rows according to selected criteria. Not available at design time.

Syntax

object.Sort [=value]

The Sort property syntax has these parts:

Part | Description
object | An object expression that evaluates to an object.
value | Integer or constant specifying the type of sorting, as described in Settings.

Settings

The settings for value are:

Value | Description
0 | None
1 | Generic Ascending. Guesses whether text is string or number
2 | Generic Descending
3 | Numeric Ascending. Converts strings to numbers
4 | Numeric Descending
5 | String Ascending. Case-insensitive
6 | String Descending. Case-insensitive
7 | String Ascending. Case-sensitive
8 | String Descending. Case-sensitive
9 | Custom. Uses Compare event to compare rows

Remarks

The Sort property always sorts entire rows. The range to be sorted is specified by setting the Row and RowSel properties. If Row and RowSel are the same, Grid assumes that you want to sort all nonfixed rows.

The keys used for sorting are determined by the Col and ColSel properties, always from the left to the right. For example, if Col = 3 and ColSel = 1, the sort would be done according to the contents of columns 1, then 2, then 3.

The method used to compare the rows is determined by the setting, as explained above. The 9 (Custom) setting is the most flexible, since it fires the Compare event that allows you to compare rows in any way you want, using any columns in any order (see the Compare event for details). However, this method is also much slower that the others, typically by a factor of ten, so it should be used only when really necessary.

An alternative to using the 9 (Custom) setting is to create an invisible column, fill it with the keys, then sort based on it with one of the other settings. This is a very good approach for sorting based on dates, for example.


Sorted

Returns a value indicating whether the elements of a control are automatically sorted alphabetically.

Syntax

object.Sorted

The object placeholder represents an object expression that evaluates to an object.

Return Values

The Sorted property return values are described in the following table.

Setting | Description
True | List items are sorted by character code order.
False | (Default). List items aren't sorted alphabetically.

Remarks

When this property is True, Visual Basic handles almost all necessary string processing to maintain alphabetic order, including changing the index numbers for items as required by the addition or removal of items.

Note Using the AddItem method to add an element to a specific location in the list may violate the sort order, and subsequent additions may not be correctly sorted.


Sorted (ListView)

Returns or sets a value that determines whether the ListItem objects in a ListView control are sorted.

Syntax

object.Sorted [= boolean]

The parts of the Sorted property syntax are described in the following table.

Part | Description
object | An object expression that evaluates to a ListView control.
boolean | A Boolean expression specifying whether the ListItem objects are sorted, as described in Settings.

Settings

The Sorted property settings are described in the following table.

Setting | Description
True | The list items are sorted alphabetically, according to the SortOrder property.
False | The list items are not sorted.

Remarks

The Sorted property must be set to True for the settings in the SortOrder and SortKey properties to take effect.

Each time the coordinates of a ListItem change, the Sorted property becomes False.


Sorted (TreeView)

Returns or sets a value that determines whether the child nodes of a Node object are sorted alphabetically.

Returns or sets a value that determines whether the root level nodes of a TreeView control are sorted alphabetically.

Syntax

object.Sorted [ = boolean]

The parts of the Sorted property syntax are described in the following table.

Part | Description
object | An object expression that evaluates to an object.
boolean | A Boolean expression specifying whether the Node objects are sorted, as described in Settings.

Settings

The Sorted property settings are described in the following table.

Setting | Description
True | The Node objects are sorted alphabetically by their Text property. Node objects whose Text property begins with a number are sorted as strings, with the first digit determining the initial position in the sort, and subsequent digits determining sub-sorting.
False | The Node objects are not sorted.

Remarks

The Sorted property can be used in two ways: first, to sort the Node objects at the root (top) level of a TreeView control and, second, to sort the immediate children of any individual Node object.

Setting the Sorted property to True sorts the current Nodes collection only. When you add new Node objects to a TreeView control, you must set the Sorted property to True again to sort the added Node objects.


SortKey

Returns or sets a value that determines how the ListItem objects in a ListView control are sorted.

The parts of the SortKey property syntax are described in the following table.

Part | Description
object | An object expression that evaluates to a ListView control.
integer | An integer specifying the sort Key, as described in Settings.

Settings

The SortKey property settings are described in the following table.

Setting | Description
0 | Sort using the ListItem object's Text property.
> 1 | Sort using the subitem whose collection Index is specified here.

Remarks

The Sorted property must be set to True before the change takes place.


SortOrder

Returns or sets a value that determines whether ListItem objects in a ListView control are sorted in ascending or descending order.

Syntax

object.SortOrder [= integer]

The parts of the SortOrder property syntax are described in the following table.

Part | Description
object | An object expression that evaluates to a ListView control.
integer | An integer specifying the type of sort order, as described in Settings.

Settings

The SortOrder property settings are described in the following table.

Value | Description
0 | (Default) Ascending order. Sorts from the beginning of the alphabet (A-Z) or the earliest date. Numbers are sorted as strings, with the first digit determining the initial position in the sort, and subsequent digits determining sub-sorting..
1 | Descending order. Sorts from the end of the alphabet (Z-A) or the latest date. Numbers are sorted as strings, with the first digit determining the initial position in the sort, and subsequent digits determining sub-sorting.

Remarks

The Sorted property must be set to True before a list will be sorted in the order specified by SortOrder.


Source

Returns or sets the name of the object or application that originally generated the error.

Syntax

object.Source [= stringexpression]

The parts of the Source property syntax are described in the following table.

Part | Description
object | Always the Err object.
stringexpression | A string expression representing the application that generated the error.

Remarks

Use Source to provide your users with information when your code is unable to handle an error generated in an accessed object.

Source always contains the name of the object that originally generated the error. Your code can try to handle the error according to the error documentation of the object you accessed. If your error handler fails, you can use the Err object information to describe the error to your user, using Source and the other Err to inform the user which object originally caused the error, its description of the error, and so forth.


StartUpPosition

Returns or sets a value specifying the position of an object when it first appears.

Syntax

object.StartUpPosition = position

The parts of the StartUpPosition property syntax are described in the following table.

Part | Description
object | An object expression that evaluates to an object.
StartUpPosition | An integer that specifies the position of the object, as shown in Settings.

Settings

For the StartUpPosition, use one of the four settings described in the following table.

Constant | Value | Description
vbStartUpManual | 0 | No initial setting specified.
vbStartUpOwner | 1 | Center on the item to which the UserForm belongs.
vbStartUpScreen | 2 | Center on the whole screen.
vbStartUpWindowsDefault | 3 | Position in upper-left corner of screen.

Remarks

You can set the StartUpPosition property programmatically or from the property window.


State

Returns the state of the control, expressed as an enumerated type. Read-only and unavailable at design time. Returns an integer that indicates the state of the control, expressed as an enumerated type.

Syntax

object.State

Data Type

Integer.

Settings

The settings for the State property are described in the following table.

Constant | Value | Description
sckClosed | 0 | Default. Closed
sckOpen | 1 | Open
sckListening | 2 | Listening
sckConnected | 7 | Connected
sckError | 9 | Error


SThreshold

Sets and returns the minimum number of characters allowable in the transmit buffer before the Comm control sets the CommEvent property to comEvSend and generates the OnComm event.

Syntax

object.SThreshold [ = value ]

The parts of the SThreshold property syntax are described in the following table.

Part | Description
object | An object expression that evaluates to an object.
value | An integer expression representing the minimum number of characters in the transmit buffer before the OnComm event is generated.

Remarks

Setting the SThreshold property to 0 (the default) disables generating the OnComm event for data transmission events. Setting the SThreshold property to 1 causes the Comm control to generate the OnComm event when the transmit buffer is completely empty.

If the number of characters in the transmit buffer is less than value, the CommEvent property is set to comEvSend, and the OnComm event is generated. The comEvSend event is only fired once, when the number of characters crosses the SThreshold property. For example, if SThreshold equals five, the comEvSend event occurs only when the number of characters drops from five to four in the output queue. If there are never more than SThreshold characters in the output queue, the event is never fired.

Data Type

Integer


Stretch

Returns/sets a value that determines whether a graphic resizes to fit the size of an Image control.

Syntax

object.Stretch

Settings

The settings for object are described in the following table.

Setting | Description
True | The graphic resizes to fit the control.
False | (Default) The control resizes to fit the graphic.


StrikeThrough

Returns or sets the font style of the Font object to either strikethrough or non-strikethrough.

Syntax

object.StrikeThrough [= boolean]

The parts of the StrikeThrough property syntax are described in the following table.

Part | Description
object | An object expression that evaluates to an object.
boolean | A Boolean expression specifying the font style, as described in Settings.

Settings

The settings for boolean are described in the following table.

Setting | Description
True | Turns on strikethrough formatting.
False | (Default). Turns off strikethrough formatting.

Remarks

The Font object is not directly available at design time. Instead you set the StrikeThrough property by choosing a control's Font property in the Properties window and clicking the Properties button. In the Font dialog box, select the Strikeout check box. At run time, however, you set StrikeThrough directly by specifying its setting for the Font object.


Style

Returns or sets a value indicating the display type and behavior of the control. Read-only at run time.

Syntax

object.Style

The object placeholder represents an object expression that evaluates to an object.

Settings

The Style property settings for the Checkbox, CommandButton, and OptionButton controls are described in the following table.

Value | Description
0 | (Default) Standard. The control displays as it did in previous versions of Visual Basic. That is, a Checkbox control displays as a checkbox with a label next to it, an OptionButton as an option button with a label next to it, and a CommandButton as a standard CommandButton without an associated graphic.
1 | Graphical. The control displays in a graphical style. That is, a Checkbox control displays as a CommandButton-like button which can be toggled either up or down, an OptionButton displays as a CommandButton-like button which remains toggled up or down until another OptionButton in its option group is selected, and a CommandButton displays as a standard CommandButton that can also display an associated graphic.

The Style property settings for the ComboBox control are described in the following table.

Value | Description
0 | (Default). Dropdown Combo. Includes a drop-down list and a text box. The user can select from the list or type in the text box.
1 | Simple Combo. Includes a text box and a list, which does not drop down. The user can select from the list or type in the text box. The size of a Simple combo box includes both the edit and list portions. By default, a Simple combo box is sized so that none of the list is displayed. Increase the Height property to display more of the list.
2 | Dropdown List. This style allows selection only from the drop-down list.

The Style property setting for the ListBox control is described in the following table.

Value | Description
0 | (Default) Standard. The ListBox control displays as it did in previous versions of Visual Basic, as a list of text items.

Remarks

For the ComboBox control, follow these guidelines in deciding which setting to choose:

  • Use setting 0 (Dropdown Combo) or setting 1 (Simple Combo) to give the user a list of choices. Either style enables the user to enter a choice in the text box. Setting 0 saves space on the form because the list portion closes when the user selects an item.
  • Use setting 2 (Dropdown List) to display a fixed list of choices from which the user can select one. The list portion closes when the user selects an item.


Style (TabStrip)

Returns or sets the appearance—tabs or buttons—of a TabStrip control.

Syntax

object.Style [= value]

The Style property syntax has these parts:

Part | Description
object | The object placeholder represents an object expression that evaluates to an object.
value | A constant or integer that determines the appearance of the tabbed dialog box, as described in Settings.

Settings

The settings for value are:

Value | Description
0 | (Default) Tabs. The tabs appear as notebook tabs, and the internal area has a three-dimensional border around it.
1 | Buttons. The tabs appear as regular push buttons, and the internal area has no border around it.

Remarks

At design time, select the Style property you want—tabs or buttons—from the Style list on the General tab of the Prperties Page of the TabStrip control.

At run time, use code like the following to set the Style property:

' Style property set to the Tabs style.
TabStrip1.Style = tabTabs

' Style property set to the Buttons style.
TabStrip1.Style = tabButtons


Style (TreeView)

Returns or sets the type of graphics (images, text, plus/minus, and lines) and text that appear for each Node object in a TreeView control.

Syntax

object.Style [ = number]

The parts of the Style property syntax are described in the following table.

Part | Description
object | An object expression that evaluates to an object.
number | An integer specifying the style of the graphics, as described in Settings.

Settings

The settings for number are described in the following table.

Setting | Description
0 | Text only.
1 | Image and text.
2 | Plus/minus and text.
3 | Plus/minus, image, and text.
4 | Lines and text.
5 | Lines, image, and text.
6 | Lines, plus/minus, and text.
7 | (Default) Lines, plus/minus, image, and text.

Remarks

If the Style property is set to a value that includes lines, the LineStyle property determines the appearance of the lines. If the Style property is set to a value that does not include lines, the LineStyle property will be ignored.


TabFixedHeight

Returns or sets the fixed height and width of all Tab objects in a TabStrip control, but only if the TabWidthStyle property is set to tabFixed.

Syntax

object.TabFixedHeight [= integer]

object.TabFixedWidth [= integer]

The TabFixedHeight and TabFixedWidth properties syntax has these parts:

Part | Description
object | An object expression that evaluates to an object.
integer | The number of pixels or twips of the height or width of a TabStrip control. The scale used for integer is dependent on the ScaleMode of the container.

Remarks

The TabFixedHeight property applies to all Tab objects in the TabStrip control. It defaults either to the height of the font as specified in the Font property, or the height of the ListImage object specified by the Image property, whichever is higher, plus a few extra pixels as a border. If the TabWidthStyle property is set to tabFixed, and the value of the TabFixedWidth property is set, the width of each Tab object remains the same whether you add or delete Tab objects in the control.


TabFixedWidth

Returns or sets the fixed height and width of all Tab objects in a TabStrip control, but only if the TabWidthStyle property is set to tabFixed.

Syntax

object.TabFixedHeight [= integer]

object.TabFixedWidth [= integer]

The TabFixedHeight and TabFixedWidth properties syntax has these parts:

Part | Description
object | An object expression that evaluates to an object.
integer | The number of pixels or twips of the height or width of a TabStrip control. The scale used for integer is dependent on the ScaleMode of the container.

Remarks

The TabFixedHeight property applies to all Tab objects in the TabStrip control. It defaults either to the height of the font as specified in the Font property, or the height of the ListImage object specified by the Image property, whichever is higher, plus a few extra pixels as a border. If the TabWidthStyle property is set to tabFixed, and the value of the TabFixedWidth property is set, the width of each Tab object remains the same whether you add or delete Tab objects in the control.


TabIndex

Returns or sets the tab order of most objects within their parent form.

Syntax

object.TabIndex [= index]

The parts of the TabIndex property syntax are described in the following table.

Part | Description
object | An object expression that evaluates to an object.
index | An integer from 0 to (n–1), where n is the number of controls on the form that have a TabIndex property. Assigning a TabIndex value of less than 0 generates an error.

Remarks

By default, Visual Basic assigns a tab order to controls as you draw them on a form, with the exception of the Menu, Timer, Line and Shape controls, which are not included in the tab order. At run time, invisible or disabled controls and controls that cannot receive the focus (Frame and Label controls) remain in the tab order but are skipped during tabbing.

Each new control is placed last in the tab order. If you change the value of a control's TabIndex property to adjust the default tab order, Visual Basic automatically renumbers the TabIndex of other controls to reflect insertions and deletions.

The TabIndex property is not affected by the ZOrder method.

Note A control's tab order does not affect its associated access key. If you press the access key for a Frame or Label control, the focus moves to the next control in the tab order that can receive the focus.

When loading forms saved as ASCII text, controls with a TabIndex property that are not listed in the form description are automatically assigned a TabIndex value. In subsequently loaded controls, if existing TabIndex values conflict with earlier assigned values, the controls are automatically assigned new values.

When you delete one or more controls, you can use the Undo command to restore the controls and all their properties except for the TabIndex property, which cannot be restored. TabIndex is reset to the end of the tab order when you use Undo.


Tabs

Returns a reference to the collection of Tab objects in a TabStrip control.

Syntax

object.Tabs(index)

The Tabs property syntax has these parts:

Part | Description
object | An object expression that evaluates to an object.
index | A value that identifies a Tab object in the Tabs collection. This may either be the Index property or the Key property of the desired Tab object.

Remarks

The Tabs collection can be accessed by using the standard collection methods, such as the Item method.


TabStop

Returns or sets a value indicating whether a user can use the TAB key to give the focus to an object.

Syntax

object.TabStop [= boolean]

The parts of the TabStop property syntax are described in the following table.

Part | Description
object | An object expression that evaluates to an object.
boolean | A Boolean expression specifying whether the object is a tab stop, as described in Settings.

Settings

The settings for boolean are described in the following table.

Setting | Description
True | (Default). Designates the object as a tab stop.
False | Bypasses the object when the user is tabbing, although the object still holds its place in the actual tab order, as determined by the TabIndex property.

Remarks

This property enables you to add or remove a control from the tab order on a form.


TabWidthStyle

Returns or sets a value that determines the justification or width of all Tab objects in a TabStrip control.

Syntax

object.TabWidthStyle [=value]

The TabWidthStyle property syntax has these parts:

Part | Description
object | An object expression that evaluates to an object.
value | An integer or constant that determines whether tabs are justified or set to a fixed width, as described in Settings.

Settings

The settings for value are:

Value | Description
0 | (Default) Justified. If the MultiRow property is set to True, each tab is wide enough to accommodate its contents and, if needed, the width of each tab is increased so that each row of tabs spans the width of the control. If the MultiRow property is set to False, or if there is only a single row of tabs, this setting has no effect.
1 | Nonjustified. Each tab is just wide enough to accommodate its contents. The rows are not justified, so multiple rows of tabs are jagged.
2 | Fixed. All tabs have an identical width, which is determined by the TabFixedWidth property.

Remarks

At design time you can set the TabWidthStyle property on the General tab of the Properties Page of the TabStrip control. The setting of the TabWidthStyle property affects how wide each Tab object appears at run time.

At run time, you can set the TabWidthStyle property as follows:

' Justifies all the tabs in a row to fit the width of the control.
TabStrip1.MultiRow = True
TabStrip1.TabWidthStyle = tabJustified

' Creates ragged rows of tabs.
TabStrip1.MultiRow = True
TabStrip1.TabWidthStyle = tabNonJustified

' Sets the same width for all tabs.
TabStrip1.TabFixedWidth = 500
TabStrip1.TabWidthStyle = tabFixed


Tag

Returns or sets an expression that stores any extra data needed for your program. Unlike other properties, the value of the Tag property is not used by Visual Basic; you can use this property to identify objects.

Syntax

object.Tag [= expression]

The parts of the Tag property syntax are described in the following table.

Part | Description
object | An object expression that evaluates to an object.
expression | A string expression identifying the object. The default is a zero-length string ("").

Remarks

You can use this property to assign an identification string to an object without affecting any of its other property settings or causing side effects. The Tag property is useful when you need to check the identity of a control that is passed as a variable to a procedure.

Tip When you create a new instance of a form, assign a unique value to the Tag property.


TaskVisible

Returns or sets a value that determines if the application appears in the Windows task list.

Syntax

object.TaskVisible [= boolean]

The parts of the TaskVisible property syntax are described in the following table.

Part | Description
object | An object expression that evaluates to an object.
boolean | A Boolean expression that determines if the application appears in the task list, as described in Settings.

Settings

The settings for boolean are described in the following table.

Setting | Description
True | (Default) The application appears in the Windows task list.
False | The application does not appear in the Windows task list.

Remarks

The TaskVisible property can only be set to False in applications that do not display an interface, such as ActiveX components that do not contain or display Form objects. While the application displays an interface, the TaskVisible property is automatically set to True.


Text

  • ComboBox control (Style property set to 0 [Dropdown Combo] or to 1 [Simple Combo]) and TextBox control — returns or sets the text contained in the edit area.
  • ComboBox control (Style property set to 2 [Dropdown List]) and ListBox control — returns the selected item in the list box; the value returned is always equivalent to the value returned by the expression List(ListIndex). Read-only at design time; read-only at run time.

Syntax

object.Text [= string]

The parts of the Text property syntax are described in the following table.

Part | Description
object | An object expression that evaluates to an object.
string | A string expression specifying text.

Remarks

At design time only, the defaults for the Text property are:

  • ComboBox and TextBox controls — the control's Name property.
  • ListBox control — a zero-length string ("").

For a ComboBox with the Style property set to 0 (Dropdown Combo) or to 1 (Simple Combo) or for a TextBox, this property is useful for reading the actual string contained in the edit area of the control. For a ComboBox or ListBox control with the Style property set to 2 (Dropdown List), you can use the Text property to determine the currently selected item.

The Text setting for a TextBox control is limited to 2048 characters unless the MultiLine property is True, in which case the limit is about 32K.


Text (Grid)

Returns or sets the text contents of a cell or range of cells.

Syntax

object.Text [= string ]

The Text property syntax has these parts:

Part | Description
object | An object expression that evaluates to an object.
string | A string expression containing the text contents of a cell or range of cells.

Remarks

When retrieving, the Text property always retrieves the contents of the current cell, defined by the Row and Col properties.

When setting, the Text property sets the contents of the current cell or of the current selection, depending on the setting of the FillStyle property.


TextArray

Returns or sets the text contents of an arbitrary cell.

Syntax

object.TextArray( cellindex ) [= string ]

The TextArray property syntax has these parts:

Part | Description
object | An object expression that evaluates to an object.
cellindex | Integer. A numeric expression specifying which cell to read or write. See Remarks.
string | A string expression containing the contents of an arbitrary cell.

Remarks

This property allows you to set or retrieve the contents of a cell without changing the Row and Col properties.

The cellindex argument determines which cell to use. It is calculated by multiplying the desired row by the Cols property and adding the desired column.


TextMatrix

Returns or sets the text contents of an arbitrary cell.

Syntax

object.TextMatrix( rowindex, colindex ) [= string ]

The TextMatrix property syntax has these parts:

Part | Description
object | An object expression that evaluates to an object.
rowindex, colindex | Integer. Numeric expressions specifying which cell to read or write.
string | A string expression containing the contents of an arbitrary cell.

Remarks

This property allows you to set or retrieve the contents of a cell without changing the Row and Col properties.


TextStyle

Returns or sets the three-dimensional style for text on a specific cell or range of cells. TextStyle determines the style of regular Grid cells.

Syntax

object.TextStyle[= style ]

The TextStyle property syntax have these parts:

Part | Description
object | An object expression that evaluates to an object.
style | Integer or constant that specifies the text style, as described in Settings.

Settings

Settings for style are:

Value | Description
0 | Flat (normal text)
1 | Raised
2 | Inset
3 | Raised Light
4 | Inset Light

Remarks

Settings 1 and 2 work best for large and bold fonts. Settings 3 and 4 work best for small regular fonts.


Title

Returns or sets the title of the application that is displayed in the Microsoft Windows CE Task List. If changed at run time, changes are not saved with the application.

Syntax

object.Title [= value]

The parts of the Title property syntax are described in the following table.

Part | Description
object | An object expression that evaluates to an object.
value | A string expression specifying the title of the application. The maximum length of value is 40 characters. In DBCS (double-byte character set) systems, this means the maximum length is 40 bytes.

Remarks

This property is available at design time in the dialog box for the Project Properties command on the Project menu.


Top

The Top property returns or sets the distance between the internal top edge of an object and the top edge of its container.

Syntax

object.Top [= value]

The parts of the Top property syntax are described in the following table.

Part | Description
object | An object expression that evaluates to an object.
value | A numeric expression that specifies distance.

Remarks

For a form, a Top property is always expressed in twips; for a control, they are measured in units depending on the coordinate system of its container. The values for these properties change as the object is moved by the user or by code. For the Timer control, this property is not available at run time.

For either property, you can specify a single-precision number.

Use the Left, Top, Height, and Width properties for operations based on an object's external dimensions, such as moving or resizing. Use the ScaleLeft, ScaleTop, ScaleHeight, and ScaleWidth properties for operations based on an object's internal dimensions, such as drawing or moving objects that are contained within the object. The scale-related properties apply only to Form objects.


Top (ActiveX)

The Left property returns or sets the distance between the internal left edge of an object and the left edge of its container. The Top property returns or sets the distance between the internal top edge of an object and the top edge of its container.

Syntax

object.Left [= value]

object.Top [= value]

The parts of the Left and Top property syntaxes are described in the following table.

Part | Description
object | An object expression that evaluates to an object.
value | A numeric expression specifying distance.

Remarks

For a control the Left and Top properties are always measured in units depending on the coordinate system of its container. The values for these properties change as the object is moved by the user or by code.

For either property, you can specify a single-precision number.

Use the Left, Top, Height, and Width properties for operations based on an object's external dimensions, such as moving or resizing.


TopIndex

Returns or sets a value that specifies which item in a ComboBox or ListBox control is displayed in the topmost position. Not available at design time.

Syntax

object.TopIndex [= value]

The parts of the TopIndex property syntax are described in the following table.

Part | Description
object | An object expression that evaluates to an object.
value | The number of the list item that is displayed in the topmost position. The default is 0, or the first item in the list.

Remarks

Use this property to scroll through a control without selecting an item.

If the Columns property is set to 0 for the ListBox control, the item is displayed at the topmost position if there are enough items below it to fill the visible portion of the list.

If the Columns property setting is greater than 0 for the ListBox control, the item's column moves to the leftmost position without changing its position within the column.


TopRow

Returns or sets the uppermost visible row (other than a fixed row) in the Grid. Not available at design time.

Syntax

object.TopRow [= number ]

The TopRow property syntax has these parts:

Part | Description
object | An object expression that evaluates to an object.
number | Long. A numeric expression specifying the uppermost row in Grid.

Remarks

You can use this property in code to programmatically read or set the visible top row of the Grid. Use the LeftCol property to determine the leftmost visible column in the Grid.

When setting this property, the largest possible row number is the total number of rows minus the number of rows that can be visible in the Grid. Attempting to set TopRow to a greater row number will cause the Grid to set it to the largest possible value.


TwipsPerPixelX

Return the number of twips per pixel for an object measured horizontally (TwipsPerPixelX) or vertically (TwipsPerPixelY).

Syntax

object.TwipsPerPixelX

object.TwipsPerPixelY

The object placeholder represents an object expression that evaluates to an object.

Remarks

You can use these properties to convert measurements quickly without changing an object's ScaleMode property setting.


TwipsPerPixelY

Return the number of twips per pixel for an object measured horizontally (TwipsPerPixelX) or vertically (TwipsPerPixelY).

Syntax

object.TwipsPerPixelX

object.TwipsPerPixelY

The object placeholder represents an object expression that evaluates to an object.

Remarks

You can use these properties to convert measurements quickly without changing an object's ScaleMode property setting.


Type

Indicates the operational type or data type of a Property object.

Return Values

Sets or returns values from the DataTypeEnum enumeration. The following ADO constants are supported.

Constant | Value | Description
adWChar | 8 | A null-terminated character string (Unicode)
adBinary | 128 | A binary value
adInteger | 3 | A 4-byte signed integer
adSmallInt | 2 | A 2-byte signed integer
adDouble | 5 | A double-precision floating point value
adDate | 7 | A Date value
adUnsignedSmallInt | 18 | A 2-byte unsigned integer
adUnsignedInt | 19 | A 4-byte unsigned integer


Underline

Returns or sets the font style of the Font object to either underlined or nonunderlined.

Syntax

object.Underline [= boolean]

The parts of the Underline property syntax are described in the following table.

Part | Description
object | An object expression that evaluates to an object.
boolean | A Boolean expression specifying the font style, as described in Settings.

Settings

The settings for boolean are described in the following table.

Setting | Description
True | Turns on underline formatting.
False | (Default). Turns off underline formatting.

Remarks

The Font object is not directly available at design time. Instead, set the Underline property by selecting a control's Font property in the Properties window and clicking the Properties button. In the Font dialog box, select the Underline check box. At run time, however, you set Underline directly by specifying its setting for the Font object.


UnderlyingValue

Indicates a Field object's current value in the database.

Return Value

Returns a Variant value.

Remarks

Use the UnderlyingValue property to return the current field value from the database.

The OriginalValue property is not supported.


UseMnemonic

Returns or sets a value that specifies whether an ampersand (&) included in the text of the Caption property of the Label control defines an access key.

Syntax

object.UseMnemonic [= boolean]

The parts of the UseMnemonic property syntax are described in the following table.

Part | Description
object | An object expression that evaluates to an object.
boolean | A Boolean expression specifying whether the Label control enables an access key, as described in Settings.

Settings

The settings for boolean are described in the following table.

Setting | Description
True | (Default). Any ampersand appearing in the text of the Caption property causes the character following the ampersand to become an access key. The ampersand itself is not displayed in the interface of the Label control.
False | Any ampersand appearing in the text of the Caption property is displayed as an ampersand in the interface of the Label control.

Remarks

At run time, pressing ALT+ the access key defined in the Label control's Caption property moves focus to the control that follows the Label control in the tab order.


Value

  • CheckBox and OptionButton controls—returns or sets the state of the control.
  • CommandButton control—returns or sets a value indicating whether the button is chosen; not available at design time.
  • HScrollBar and VScrollBar controls (horizontal and vertical scroll bars)—returns or sets the current position of the scroll bar, whose return value is always between the values for the Max and Min properties, inclusive.

Syntax

object.Value [= value]

The parts of the Value property syntax are described in the following table.

Part | Description
object | An object expression that evaluates to an object.
value | Value specifying the state, content, or position of a control, as described in Settings.

Settings

The settings for value are described in the following table.

Control | Description
CheckBox control | 0 is Unchecked (default), 1 is Checked, and 2 is Grayed (dimmed).
CommandButton control | True indicates the button is chosen; False (default) indicates the button is not chosen. Setting the Value property to True in code invokes the button's Click event.
HScrollBar and VScrollBar controls | Set values between –32,768 and 32,767 to position the scroll box.
OptionButton control | True indicates the button is selected; False (default) indicates the button is not selected.

Remarks

A default property of an object is assumed, and does not need to be specified in code.


Value (ADO)

Indicates the value assigned to a Field object.

Return Value

Sets or returns a Variant value. The default value depends on the Type property.

Remarks

Use the Value property to set or return data from Field objects.

ADO allows setting and returning long binary data with the Value property.

Underlying PegDB datatypes should be converted as follows:

Constant | Value | Description
pegvt_lpwstr | VT_BSTR | A null-terminated character string (Unicode)
pegvt_blob |  | A binary value
adInteger | VT_I4 | A 4-byte signed integer
adSmallInt | VT_I2 | A 2-byte signed integer
adDouble | VT_R8 | A double-precision floating point value
adDate | VT_DATE | A Date value
adUnsignedSmallInt | VT_UI2 | A 2-byte unsigned integer
adUnsignedInt | VT_UI4 | A 4-byte unsigned integer


Version

Returns the version (as an integer) of the Grid control currently loaded in memory.

Syntax

object.Version

The object placeholder represents an object expression that evaluates to an object.

Remarks

The version number is a three-digit integer where the first digit represents the major version number and the last two represent the minor version number. For example, version 3.5 would return 350.


View

Returns or sets the appearance of the ListItem objects in a ListView control.

Syntax

object.View [= value]

The parts of the View property syntax are described in the following table.

Part | Description
object | The object expression that evaluates to a ListView control.
value | An integer or constant specifying the control's appearance, as described in Settings.

Settings

The settings for value are described in the following table.

Value | Description
0 | (Default) Icon. Each ListItem object is represented by a full-sized (standard) icon and a text label.
1 | SmallIcon. Each ListItem object is represented by a small icon and a text label that appears to the right of the icon. The items appear horizontally.
2 | List. Each ListItem object is represented by a small icon and a text label that appears to the right of the icon. The ListItem objects are arranged vertically, each on its own line with information arranged in columns.
3 | Report. Each ListItem object is displayed with its small icon and text labels. You can provide additional information about each ListItem object in a subitem. The icons, text labels, and information appear in columns with the leftmost column containing the small icon, followed by the text label. Additional columns display the text for each of the item's subitems.

Remarks

In Icon view only, use the LabelWrap property to specify if the ListItem object's labels are wrapped or not.

In Report view, you can hide the column headers by setting the HideColumnHeaders property to True. You can also use the ColumnClick event and the Sorted, SortOrder, and SortKey properties to sort the ListItem objects or subitems when a user clicks a column header. The user can change the size of the column by grabbing the right border of a column header and dragging it to the desired size.


Visible

Returns or sets a value indicating whether an object is visible or hidden.

Syntax

object.Visible [= boolean]

The parts of the Visible property syntax are described in the following table.

Part | Description
object | An object expression that evaluates to an object.
boolean | A Boolean expression specifying whether the object is visible or hidden.

Settings

The settings for boolean are described in the following table.

Setting | Description
True | (Default). Object is visible.
False | Object is hidden.

Remarks

To hide an object at startup, set the Visible property to False at design time. Setting this property in code enables you to hide and later redisplay a control at run time in response to a particular event.

Note Using the Show or Hide method on a form is the same as setting the form's Visible property in code to True or False, respectively.


Weight

Returns or sets the weight of the characters that make up a Font object. The weight refers to the thickness of the characters, or the "boldness factor". The higher the value, the bolder the character.

Syntax

object.Weight [= number]

The parts of the Weight property syntax are described in the following table.

Part | Description
object | An object expression that evaluates to an object.
number | A numeric expression specifying the weight of the font.

Remarks

The Font object is not directly available at design time. You set the Weight property of the Font object by selecting a control's Font property in the Properties window and clicking the Properties button. You implicitly set the Weight property by selecting an item from the Font Style box in the Font dialog box. The Regular and Italic settings have a Weight value of 400 (the default), and the Bold and Bold Italic settings have a Weight value of 700. At run time, however, you set Weight directly by specifying its setting for the Font object.

If you set a Font object's Weight to a value other than 400 or 700 at run time, Visual Basic converts your value to either 400 or 700, depending on which value is closest to the value you set. The precise ranges are: Weight > 400 and < 551 converts to 400; Weight > 550 converts to 700.


Width

Measured from the center of the control's border so that controls with different border widths align correctly. These properties use the scale units of a control's container.

Syntax

object.Height [= number]

object.Width [= number]

The parts of the Height and Width property syntaxes are described in the following table.

Part | Description
object | An object expression that evaluates to an object.
number | A numeric expression specifying the dimensions of an object, as described in Settings.

Settings

Measurements are calculated as follows:

  • Form — the external height and width of the form, including the borders and title bar.
  • Control — measured from the center of the control's border so that controls with different border widths align correctly. These properties use the scale units of a control's container.
  • Screen object — the height and width of the screen; not available at design time and read-only at run time.

Remarks

For Form and Screen objects, these properties are always measured in twips. For a form or control, the values for these properties change as the object is sized by the user or by your code. Maximum limits of these properties for all objects are system-dependent.

Use the Height, Width, Left, and Top properties for operations or calculations based on an object's total area, such as sizing or moving the object. Use the ScaleLeft, ScaleTop, ScaleHeight, and ScaleWidth properties for operations or calculations based on an object's internal area, such as drawing or moving objects within another object.

The Height property cannot be changed for the DriveListBox control or for the ComboBox control, whose Style property setting is 0 (Dropdown Combo) or 2 (Dropdown List).

For the Picture object, use the ScaleX and ScaleY methods to convert HiMetric units into the scale you need.


Width (ActiveX)

Returns or sets the dimensions of an object.

Syntax

object.Height [= number]

object.Width [= number]

The Height and Width property syntaxes have these parts:

Part | Description
number | A numeric expression specifying the dimensions of an object, as described in Settings.

Settings

Measurements are measured from the center of the control's border so that controls with different border widths align correctly. These properties use the scale units of a control's container.

Remarks

For a control, the values for these properties change as the object is sized by the user or by your code. Maximum limits of these properties for all objects are system-dependent.

Use the Height, Width, Left, and Top properties for operations or calculations based on an object's total area, such as sizing or moving the object.


WindowState

Returns or sets a value indicating the visual state of a form window at run time.

Syntax

object.WindowState [= value]

The parts of the WindowState property syntax are described in the following table.

Part | Description
object | An object expression that evaluates to an object.
value | An integer specifying the state of the object, as described in Settings.

Settings

The settings for value are described in the following table.

Constant | Value | Description
vbNormal | 0 | (Default). Normal.
vbMinimized | 1 | Minimized (minimized to an icon)
vbMaximized | 2 | Maximized (enlarged to maximum size)

Remarks

Before a form is displayed, the WindowState property is always set to Normal (0), regardless of its initial setting. This is reflected in the Height, Left, ScaleHeight, ScaleWidth, Top, and Width property settings. If a form is hidden after it has been shown, these properties reflect the previous state until the form is shown again, regardless of any changes made to the WindowState property in the meantime.


WordWrap

Returns or sets a value indicating whether a Label control with its AutoSize property set to True expands vertically or horizontally to fit the text specified in its Caption property.

Syntax

object.WordWrap [= boolean]

The parts of the WordWrap property syntax are described in the following table.

Part | Description
object | An object expression that evaluates to an object.
boolean | A Boolean expression specifying whether the Label expands to fit the text, as described in Settings.

Settings

The settings for boolean are described in the following table.

Setting | Description
True | The text wraps; the Label control expands or contracts vertically to fit the text and the size of the font. The horizontal size does not change.
False | (Default). The text does not wrap; the Label expands or contracts horizontally to fit the length of the text and vertically to fit the size of the font and the number of lines.

Remarks

Use this property to determine how a Label control displays its contents. For example, a graph that changes dynamically might have a Label containing text that also changes. To maintain a constant horizontal size for the Label and allow for increasing or decreasing text, set the WordWrap and AutoSize properties to True.

If you want a Label control to expand only horizontally, set WordWrap to False. If you do not want the Label to change size, set AutoSize to False.

Note If AutoSize is set to False, the text always wraps, regardless of the size of the Label control or the setting of the WordWrap property. This may obscure some text because the Label does not expand in any direction.


WordWrap (Grid)

Returns or sets a value that determines whether text within a cell should be broken between words if a word would extend past the edge of the cell. Return characters – Chr(13) – also force line breaks.

Syntax

object.WordWrap [= boolean ]

The WordWrap property syntax has these parts:

Part | Description
object | An object expression that evaluates to an object.
boolean | Determines if the text within a cell wraps. This property is False by default.

Remarks

Grid can display text slightly faster if you set WordWrap to False.


X1,Y1,X2,Y2

Return or set the coordinates of the starting point (X1, Y1) and ending point (X2, Y2) of a Line control. The horizontal coordinates are X1 and X2; the vertical coordinates are Y1 and Y2.

Syntax

object.X1 [= value]

object.Y1 [= value]

object.X2 [= value]

object.Y2 [= value]

The parts of the X1, Y1, X2, and Y2 property syntaxes are described in the following table.

Part | Description
object | An object expression that evaluates to an object.
value | A numeric expression specifying a coordinate.

Remarks

Use these properties to dynamically extend a Line control from one point to another at run time. For example, you can show the relationships of items in one list to items in another list or connect points on a map.


Methods

Methods

Accept

Add

AddItem

AddNew

CancelUpdate

Clear

Clear (Clipboard, ComboBox, ListBox)

Clear (Grid)

Close

Close (ADO)

Close (File)

Cls

Connect

DDB

Delete

Dir

DrawCircle

DrawLine

DrawPicture

DrawPoint

End

FileCopy

FileDateTime

FileLen

FindItem

FV

Get

GetAttr

GetData

GetFirstVisible

GetFormat

GetRows

GetText

GetVisibleCount

Hide

Input, InputB

InputFields

IPmt

IRR

Kill

LineInputString

LinePrint

Listen

MIRR

MkDir

Move

Move (ADO)

MoveFile

MoveFirst, MoveLast, MoveNext, MovePrevious

NPer

NPV

Open

Open (ADO)

PMT

Point

PointSet

PPMT

Put

PV

Raise

Rate

Refresh

Remove

RemoveAll

RemoveItem

Replace

Reset

RmDir

ScaleX

ScaleY

SendData

SetAttr

SetFocus

SetScale

SetText

Show

ShowColor

ShowFont

ShowHelp

ShowOpen

ShowSave

SLN

StartLabelEdit

SYD

TextHeight

TextWidth

Update

WriteFields

ZOrder


Accept

For TCP server applications only. This method is used to accept an incoming connection when handling a ConnectionRequest event.

Syntax

object.Accept

Data Type

Long.

Return Value

Void.

Remarks

The Accept method is used in the ConnectionRequest event. The Accept method should be used on a new control instance (other than the one that is in the listening state).


Add

Add adds an image to an ImageList. Images can be .bmp, .dib or .2bp format.

Syntax

Object.Add (filename)

Remarks

Add is passed the name of a valid image file to load and adds the image to the Imagelist.


AddItem

Adds an item to a ListBox or ComboBox control or adds a row to a Grid control. AddItem does not support named arguments.

Syntax

object.AddItem item, index

The parts of the AddItem method syntax are described in the following table.

Part | Description
object | Required. An object expression that evaluates to an object.
item | Required. String expression specifying the item to add to the object. For the Grid control only, use the tab character (character code 09) to separate multiple strings you want to insert into each column of a newly added row.
index | Optional. Integer specifying the position within the object where the new item or row is placed. For the first item in a ListBox or ComboBox control or for the first row in a Grid control, index is 0. If index is omitted for the Grid control, the new row becomes the last.

Remarks

If you supply a valid value for index, item is placed at that position within the object. If index is omitted, item is added at the proper sorted position (if the Sorted property is set to True) or to the end of the list (if Sorted is set to False).


AddNew

Creates a new record for an updatable Recordset object.

Syntax

recordset.AddNew

The recordset placeholder is an object variable that represents an updatable Recordset object to which you want to add a new record.

Remarks

After you call the AddNew method, the new record becomes the current record and remains current after you call the Update method. The new record may be added to the end of the Recordset (typically if the select query required extra sorting or filtering) or will appear "in-place" in the Recordset (with the exact location depending on what index is being used). It will remain visible.

If you call AddNew while editing the current record or while adding a new record, ADO calls the Update method to save any changes and then creates the new record.

In immediate update mode (the provider writes changes to the underlying data source once you call the Update method), calling the AddNew method without arguments sets the EditMode property to adEditAdd. ADO caches any field value changes locally. Calling the Update method posts the new record to the database and resets the EditMode property to adEditNone. If you pass the Fields and Values arguments, ADO immediately posts the new record to the database (no Update call is necessary); the EditMode property value does not change (adEditNone).

ADO always updates in immediate mode. Batch mode is not supported.


CancelUpdate

Cancels any changes made to the current record or to a new record prior to calling the Update method.

Remarks

Use the CancelUpdate method to cancel any changes made to the current record or to discard a newly added record. You cannot undo changes to the current record or to a new record after you call the Update method.

If you are adding a new record when you call the CancelUpdate method, the record that was current prior to the AddNew call becomes the current record again.

If you have not changed the current record or added a new record, calling the CancelUpdate method generates an error.


Clear

Clears all property settings of the Err object.

Syntax

object.Clear

The object is always the Err object.

Remarks

Use Clear to explicitly clear the Err object after an error has been handled, for example, when you use deferred error handling with On Error Resume Next. The Clear method is called automatically whenever any of the following statements is executed:

  • Any type of Resume statement
  • Exit Sub, Exit Function, Exit Property
  • Any On Error statement

Note The On Error Resume Next construct may be preferable to On Error GoTo when handling errors generated during access to other objects. Checking Err after each interaction with an object removes ambiguity about which object was accessed by the code. You can be sure which object placed the error code in Err.Number, as well as which object originally generated the error (the object specified in Err.Source).


Clear (Clipboard, ComboBox, ListBox)

Clears the contents of a ListBox, ComboBox, or the system Clipboard.

Syntax

object.Clear

The object placeholder represents an object expression that evaluates to an object.


Clear (Grid)

Clears the contents of the Grid. This includes all text, pictures, and cell formatting. The Clear method does not affect the number of rows and columns on the Grid.

Syntax

object.Clear

The object placeholder represents an object expression that evaluates to an object.

Remarks

To remove cells instead of just clearing them, use the RemoveItem method on each row to be removed.


Close

Closes a TCP connection or a listening socket for both client and server applications. Returns the number of errors in the Errors collection. Returns a Long value.

Syntax

object.Close

Arguments

None.


Close (ADO)

Use the Close method to close a Recordset object to free any associated system resources.

Syntax

object.Close

The object placeholder an object expression that represents an open Recordset.

Remarks

Closing an object does not remove it from memory; you may change its property settings and open it again later. To completely eliminate an object from memory, set the object variable to Nothing.

Using the Close method to close a Recordset object releases the associated data and any exclusive access you may have had to the data through this particular Recordset object. You can later call the Open method to reopen the recordset with the same or modified attributes. While the Recordset object is closed, calling any methods that require a live cursor generates an error.

If an edit is in progress while in immediate update mode, calling the Close method generates an error; call the Update or CancelUpdate method first.

If you use the Clone method to create copies of an open Recordset object, closing the original or a clone does not affect any of the other copies.


Close (File)

Closes an open file handle.

Syntax

file.Close


Cls

Clears graphics and text generated at run time from a Form or PictureBox.

Syntax

object.Cls

The object placeholder represents an object expression that evaluates to an object. If object is omitted, the Form with the focus is assumed to be object.

Remarks

The Cls method clears text and graphics generated at run time by graphics and printing statements. Background bitmaps set using the Picture property and controls placed on a Form at design time are not affected by Cls. Graphics and text placed on a Form while the AutoRedraw property is set to True are not affected if AutoRedraw is set to False before Cls is invoked. That is, you can maintain text and graphics on a Form by manipulating the AutoRedraw property of the object you are working with.

After Cls is invoked, the CurrentX and CurrentY properties of object are reset to 0.


Connect

Connect to remote host at remote socket number. Returns a Long value which evaluates to S_OK on success (0).

Syntax

object.Connect


DDB

Specifies the depreciation of an asset for a specific time period using the double-declining balance method, or some other method that you specify.

Syntax

DDB(cost, salvage, life, period, factor)

The DDB function has the following named arguments:

cost
Required. Variant specifying initial cost of the asset.
salvage
Required. Variant specifying value of the asset at the end of its useful life.
life
Required. Variant specifying length of useful life of the asset.
period
Required. Variant specifying period for which asset depreciation is calculated.
factor
Required. Variant specifying rate at which the balance declines.

Remarks

The double-declining balance method computes depreciation at an accelerated rate. Depreciation is highest in the first period and decreases in successive periods.

The life and period arguments must be expressed in the same units. For example, if life is given in months, period must also be given in months. All arguments must be positive numbers.

The DDB function uses the following formula to calculate depreciation for a given period:

Depreciation / period = ((cost – salvage) * factor) / life


Delete

Deletes the current record in an open Recordset object.

Syntax

recordset.Delete

The recordset placeholder is an object variable that represents an updatable Recordset object containing the record you want to delete.

Remarks

Using the Delete method deletes the current record from the database. If the Recordset object doesn't allow record deletion, an error occurs.

Retrieving field values from the deleted record generates an error. After deleting the current record, the deleted record remains current until you move to a different record. Once you move away from the deleted record, it is no longer accessible.

If the attempt to delete records fails a run-time error occurs.


Dir

Returns a String representing the name of a file, directory, or folder that matches a specified pattern or file attribute, or the volume label of a drive.

Syntax

Dir(Pathname[, Attributes]])

The parts of the Dir function syntax are described in the following table.

Part | Description
pathname | Optional. String expression that specifies a file name—may include directory or folder, and drive. A zero-length string ("") is returned if pathname is not found.
attributes | Optional. Numeric expression, whose sum specifies file attributes. If omitted, all files are returned that match pathname.

The attributes argument settings are described in the following table.

Constant | Value | Description
vbNormal | 0 | Normal
vbHidden | 2 | Hidden
vbSystem | 4 | System file
vbVolume | 8 | Volume label; if specified, all other attributes are ignored.
vbDirectory | 16 | Directory or folder

Remarks

Dir supports the use of multiple-character (*) and single-character (?) wildcards to specify multiple files.

You must specify pathname the first time you call the Dir function, or an error occurs. If you also specify file attributes, pathname must be included.

The Dir function returns the first file name that matches pathname. To get any additional file names that match pathname, call Dir again with no arguments. When no more file names match, Dir returns a zero-length string (""). Once a zero-length string is returned, you must specify pathname in subsequent calls or an error occurs. You can change to a new pathname without retrieving all of the file names that match the current pathname. However, you cannot call the Dir function recursively. Calling Dir with the vbDirectory attribute does not continually return subdirectories.


DrawCircle

Draws a circle, ellipse, or arc on an object.

Syntax

object.DrawCircle x, y, radius, [color, aspect]

The object qualifier and parts of the DrawCircle method syntax are described in the following table.

Part | Description
object | Optional. Object expression that evaluates to an object. If object is omitted, the Form with the focus is assumed to be object.
(x, y) | Required. Single values indicating the coordinates for the center point of the circle, ellipse, or arc. The ScaleMode property of object determines the units of measure used.
radius | Required. Single value indicating the radius of the circle, ellipse, or arc. The ScaleMode property of object determines the unit of measure used.
color | Optional. Long integer value indicating the RGB color of the circle's outline. If omitted, the value of the ForeColor property is used. You can use the RGB function to specify the color.
aspect | Optional. Single-precision value indicating the aspect ratio of the circle. The default value is 1.0, which yields a perfect (non-elliptical) circle on any screen.

Remarks

To fill a circle, set the FillColor and FillStyle properties of the object on which the circle or ellipse is drawn. Only a closed figure can be filled. Closed figures include circles, ellipses, or pie slices (arcs with radius lines drawn at both ends).

The width of the line used to draw the circle, ellipse, or arc depends on the setting of the DrawWidth property. The way the circle is drawn on the background depends on the setting of the DrawMode and DrawStyle properties.

You can omit an argument in the middle of the syntax, but you must include the argument's comma before including the next argument. If you omit an optional argument, omit the comma following the last argument you specify.

When DrawCircle executes, the CurrentX and CurrentY properties are set to the center point specified by the arguments.


DrawLine

Draws lines and rectangles on an object.

Syntax

object.DrawLine x1, y1, x2, y2, [color], [vbLineBox | vbLineBoxFill]

The object qualifier and parts of the DrawLine method syntax are described in the following table.

Part | Description
object | Optional. Object expression that evaluates to an object. If object is omitted, the Form with the focus is assumed to be object.
(x1, y1) | Optional. Single values indicating the coordinates of the starting point for the line or rectangle. The ScaleMode property determines the unit of measure used. If omitted, the line begins at the position indicated by CurrentX and CurrentY.
(x2, y2) | Required. Single values indicating the coordinates of the end point for the line being drawn.
color | Optional. Long integer value indicating the RGB color used to draw the line. If omitted, the ForeColor property setting is used. You can use the RGB function to specify the color.
vbLineBox | Optional. Numeral 1. If included, causes a box to be drawn using the coordinates to specify opposite corners of the box.
vbLineBoxFill | Optional. Numeral 2. If the vbLineBox option is used, the vbLineBoxFill option specifies that the box is filled with the same color used to draw the box. You cannot use vbLineBoxFill without vbLineBox. If vbLineBoxFill is used without vbLineBox, the box is filled with the current FillColor and FillStyle. The default value for FillStyle is transparent.

Remarks

To draw connected lines, begin a subsequent line at the end point of the previous line.

The width of the line drawn depends on the setting of the DrawWidth property. The way a line or box is drawn on the background depends on the setting of the DrawMode and DrawStyle properties.

When Line executes, the CurrentX and CurrentY properties are set to the end point specified by the arguments.


DrawLine (PictureBox)

Draws lines and rectangles on an object.

Syntax

object.DrawLine x1, y1, x2, y2, [color], [box], [fill]

The parts and object qualifier of the DrawLine method syntax are described in the following table.

Part | Description
object | Optional. Object expression that evaluates to an object. If object is omitted, the Form with the focus is assumed to be object.
x1, y1 | Required. Values indicating the coordinates of the starting point for the line or rectangle. The ScaleMode property determines the unit of measure used.
x2, y2 | Required. Values indicating the coordinates of the end point for the line being drawn.
color | Optional. Long integer value indicating the RGB color used to draw the line. If omitted, the ForeColor property setting is used. You can use the RGB function or to specify the color.
box | Optional. If included, causes a box to be drawn using the coordinates to specify opposite corners of the box.
fill | Optional. If the box option is used, the fill option specifies that the box is filled with the same color used to draw the box. You cannot use fill without box. If box is used without fill, the box is filled with the current FillColor and FillStyle. The default value for FillStyle is transparent.

Remarks

To draw connected lines, begin a subsequent line at the end point of the previous line.

The width of the line drawn depends on the setting of the DrawWidth property.


DrawPicture

Draws the contents of a .bmp file on a Form or PictureBox.

Syntax

object.DrawPicture picture, x1, y1, width1, height1, x2, y2, width2, height2, opcode

The parts of the DrawPicture method syntax are described in the following table.

Part | Description
object | Optional. An object expression that evaluates to an object. If object is omitted, the Form object with the focus is assumed to be object.
picture | Required. The source file of the graphic to be drawn onto object.
x1, y1 | Required. Values indicating the destination coordinates (x-axis and y-axis) on object for picture to be drawn. The ScaleMode property of object determines the unit of measure used.
width1 | Optional. Value indicating the destination width of picture. The ScaleMode property of object determines the unit of measure used. If the destination width is larger or smaller than the source width (width2), picture is stretched or compressed to fit. If omitted, the source width is used.
height1 | Optional. Value indicating the destination height of picture. The ScaleMode property of object determines the unit of measure used. If the destination height is larger or smaller than the source height (height2), picture is stretched or compressed to fit. If omitted, the source height is used.
x2, y2 | Optional. Values indicating the coordinates (x-axis and y-axis) of a clipping region within picture. The ScaleMode property of object determines the unit of measure used. If omitted, 0 is assumed.
width2 | Optional. Single-precision value indicating the source width of a clipping region within picture. The ScaleMode property of object determines the unit of measure used. If omitted, the entire source width is used.
height2 | Optional. Value indicating the source height of a clipping region within picture. The ScaleMode property of object determines the unit of measure used. If omitted, the entire source height is used.
opcode | Optional. Value or code that is used only with bitmaps. It defines a bit-wise operation (such as vbMergeCopy or vbSrcAnd) that is performed on picture as it is drawn on object. For a complete list of bit-wise operator constants, see the RasterOp Constants topic in Visual Basic Help. The only supported codes are vbBlackness, vbNotCopyPen, vbInvert, vbXorPen, vbMergePen and vbWhiteness.

Remarks

You can flip a bitmap horizontally or vertically by using negative values for the destination height (height1) and/or the destination width (width1).

You can omit as many optional trailing arguments as you want. If you omit an optional trailing argument or arguments, do not use any commas following the last argument you specify. If you want to specify an optional argument, you must specify all optional arguments that appear in the syntax before it.


DrawPoint

Sets a point on an object to a specified color.

Syntax

object.DrawPoint x, y, [color]

The parts and object qualifier of the DrawPoint method syntax are described in the following table.

Part | Description
object | Optional. Object expression that evaluates to an object. If object is omitted, the Form with the focus is assumed to be object.
x, y | Required. Single values indicating the horizontal (x-axis) and vertical (y-axis) coordinates of the point to set.
color | Optional. Long integer value indicating the RGB color specified for point. If omitted, the current ForeColor property setting is used. You can use the RGB function to specify the color.

Remarks

The size of the point drawn depends on the setting of the DrawWidth property. When DrawWidth is 1, DrawPoint sets a single pixel to the specified color. When DrawWidth is greater than 1, the point is centered on the specified coordinates.

To clear a single pixel with the DrawPoint method, specify the coordinates of the pixel and use the BackColor property setting as the color argument.


End

Use the End method of the App object to terminate the application.

Syntax

object.End

The parts of the End method syntax are described in the following table.

Part | Description
object | Required. An object expression that evaluates to an object.

Remarks

This method is unique to Windows CE Toolkit for Visual Basic 5.0.


FileCopy

Copies an existing file to a new file.

Syntax

filesystem.FileCopy PathName, NewPathName

The parts of the FileCopy function syntax are described in the following table.

Part | Description
PathName | String that contains the file name.
NewPathName | String that contains the file name to copy to.


FileDateTime

Returns a Variant (Date) that indicates the date and time when a file was created or last modified.

Syntax

filesystem.FileDateTime (Pathname)

The required pathname argument is a string expression that specifies a file name. The pathname may include the directory or folder.


FileLen

Returns a Long specifying the length of a file in bytes.

Syntax

filesystem.FileLen (Pathname)

The required pathname argument is a string expression that specifies a file. The pathname may include the directory or folder.

Remarks

If the specified file is open when the FileLen function is called, the value returned represents the size of the file immediately before it was opened.


FindItem

Finds and returns a reference to a ListItem object in a ListView control.

Syntax

object.FindItem (string, value, index, match)

The parts of the FindItem statement syntax are described in the following table.

Part | Description
object | Required. An object expression that evaluates to a ListView control.
string | Required. A string expression indicating the ListItem object to be found.
value | Optional. An integer or constant specifying whether the string will be matched to the ListItem object's Text or SubItems property, as described in Settings.
index | Optional. An integer or string that uniquely identifies a member of an object collection and specifies the location from which to begin the search. The integer is the value of the Index property; the string is the value of the Key property. If no index is specified, the default is 1.
match | Optional. An integer or constant specifying that a match will occur if the item's Text property is the same as the string, as described in Settings.

Settings

The settings for value are described in the following table.

Value | Description
0 | (Default) Matches the string with a ListItem object's Text property.
1 | Matches the string with any string in a ListItem object's SubItems property.

The settings for match are described in the following table.

Value | Description
0 | (Default) An integer or constant specifying that a match will occur if the item's Text property begins with the whole word being searched. Ignored if the criteria is not text.
1 | An integer or constant specifying that a match will occur if the item's Text property begins with the string being searched. Ignored if the criteria is not text.

Remarks

If you specify Text as the search criteria, you can set the value to 1, so that a match occurs when the ListItem object's Text property begins with the string you are searching for.


FV

Specifies the future value of an annuity based on periodic fixed payments and a fixed interest rate.

Syntax

FV(rate, nper, pmt[, pv[, type]])

The FV function has the following named arguments:

rate
Required. Variant specifying interest rate per period. For example, if you obtain a car loan at an annual percentage rate (APR) of 10 percent and make monthly payments, the rate per period is 0.1/12, or 0.0083.
nper
Required. Variant specifying total number of payment periods in the annuity. For example, if you make monthly payments on a four-year car loan, your loan has a total of 4 * 12 (or 48) payment periods.
pmt
Required. Variant specifying payment to be made each period. Payments usually contain principal and interest that does not change over the life of the annuity.
pv
Optional. Variant specifying present value (or lump sum) of a series of future payments. For example, when you borrow money to buy a car, the loan amount is the present value to the lender of the monthly car payments you will make. If omitted, 0 is assumed.
type
Optional. Variant specifying when payments are due. Use 0 if payments are due at the end of the payment period, or use 1 if payments are due at the beginning of the period. If omitted, 0 is assumed.

Remarks

An annuity is a series of fixed cash payments made over a period of time. An annuity can be a loan (such as a home mortgage) or an investment (such as a monthly savings plan).

The rate and nper arguments must be calculated using payment periods expressed in the same units. For example, if rate is calculated using months, nper must also be calculated using months.

For all arguments, cash paid out (such as deposits to savings) is represented by negative numbers; cash received (such as dividend checks) is represented by positive numbers.


Get

Reads data from an open disk file into a variable.

Syntax

file.Get Data , [Recnumber]

The parts of the Get statement syntax are described in the following table.

Part | Description
Data | Required. Variant variable into which data is read.
Recnumber | Optional. Variant (Long). Record number (Random mode files) or byte number (Binary mode files) at which reading begins.

Remarks

Data read with Get is usually written to a file with Put.

The first record or byte in a file is at position 1, the second record or byte is at position 2, and so on. If you omit Recnumber, the next record or byte following the last Get or Put statement (or pointed to by the last Seek function) is read.

For files opened in Random mode, the following rules apply:

  • If the length of the data being read is less than the length specified in the Len clause of the Open statement, Get reads subsequent records on record-length boundaries. The space between the end of one record and the beginning of the next record is padded with the existing contents of the file buffer. Because the amount of padding data cannot be determined with any certainty, it is generally a good idea to have the record length match the length of the data being read.
  • If the variable being read into is a Variant of numeric type, Get reads 2 bytes identifying the VarType of the Variant and then the data that goes into the variable. For example, when reading a Variant of VarType 3, Get reads 6 bytes: 2 bytes identifying the Variant as VarType 3 (Long) and 4 bytes containing the Long data. The record length specified by the Len clause in the Open statement must be at least 2 bytes greater than the actual number of bytes required to store the variable.
  • You can use the Get statement to read a Variant array from disk, but you cannot use Get to read a scalar Variant containing an array. You also cannot use Get to read objects from disk.
  • If the variable being read into is a Variant of VarType 8 (String), Get reads 2 bytes identifying the VarType, 2 bytes indicating the length of the string, and then reads the string data. The record length specified by the Len clause in the Open statement must be at least 4 bytes greater than the actual length of the string.
  • If the variable being read into is a dynamic array, Get reads a descriptor whose length equals 2 plus 8 times the number of dimensions, that is, 2 + 8 * NumberOfDimensions. The record length specified by the Len clause in the Open statement must be greater than or equal to the sum of all the bytes required to read the array data and the array descriptor.
  • For files opened in Binary mode, all of the Random rules apply, except:
    • The Len clause in the Open statement has no effect. Get reads all variables from disk contiguously; that is, with no padding between records.


GetAttr

Returns a Long representing the attributes of a file, directory, or folder.

Syntax

filesystem.GetAttr(pathname)

The required pathname argument is a string expression that specifies a file name or directory or folder name. The pathname may include the directory or folder, and the drive.

Return Values

The value returned by GetAttr is the sum of the following attribute values:

Constant | Value | Description
vbNormal | 0 | Normal.
vbReadOnly | 1 | Read-only.
vbHidden | 2 | Hidden.
vbSystem | 4 | System.
vbDirectory | 16 | Directory or folder.
vbArchive | 32 | File has changed since last backup.

Remarks

To determine which attributes are set, use the And operator to perform a bitwise comparison of the value returned by the GetAttr function and the value of the individual file attribute you want. If the result is not zero, that attribute is set for the named file.


GetData

Retrieves the current block of data and stores it in a variable of type variant. GetData only supports BSTRs, and arrays of integer.

Syntax

object.GetData data

The parts of the GetData method syntax are described in the following table.

Part | Description
data | Where retrieved data will be stored after the method returns successfully.

Remarks

It is common to use the GetData method with the DataArrival event, which includes the totalBytes argument. If you specify a maxlen that is less than the totalBytes argument, you will get the warning 10040, indicating that the remaining bytes will be lost.


GetFirstVisible

Returns a reference to the first ListItem object visible in the internal area of a ListView control.

Syntax

object.GetFirstVisible()

The object placeholder represents an object expression that evaluates to a ListView control.

Remarks

A ListView control can contain more ListItem objects than can be seen in the internal area of the ListView control. You can use the reference returned by the GetFirstVisible method to determine the first visible ListItem object in List or Report view.


GetFormat

Returns an integer indicating whether an item on the Clipboard object matches a specified format. Named arguments are not supported.

Syntax

object.GetFormat (format)

The parts of the GetFormat method syntax are described in the following table.

Part | Description
object | Required. An object expression that evaluates to an object.
format | Required. A value or constant that specifies the Clipboard object format, as described in Settings. Parentheses must enclose the constant or value.

Settings

The settings for format are described in the following table.

Constant | Value | Description
vbCFLink | &HBF00 | DDE conversation information
vbCFText | 1 | Text
vbCFBitmap | 2 | Bitmap (.bmp files)
vbCFMetafile | 3 | Metafile (.wmf files)
vbCFDIB | 8 | Device-independent bitmap (DIB)
vbCFPalette | 9 | Color palette

Remarks

These constants are listed in the Visual Basic (VB) object library in the Object Browser.

The GetFormat method returns True if an item on the Clipboard object matches the specified format. Otherwise, it returns False.

For vbCFDIB and vbCFBitmap formats, whatever color palette is on the Clipboard is used when the graphic is displayed.


GetRows

Retrieves multiple records of a Recordset into an array.

Syntax

Set array = recordset.GetRows(Rows, Start, Fields)

The GetRows method syntax has the following parts.

Part | Description
Array | A Variant variable in which to store the returned data.
Rows | Optional. A Long expression indicating the number of records to retrieve. Default is adGetRowsRest (-1).
Start | Optional. A String or Variant that evaluates to the bookmark for the record from which the GetRows operation should begin.
Fields | Optional. A Variant representing a single field name or ordinal position or an array of field names or ordinal position numbers. ADO returns only the data in these fields.

Remarks

Use the GetRows method to copy records from a Recordset into a two-dimensional array. The first subscript identifies the field and the second identifies the record number. The array variable is automatically dimensioned to the correct size when the GetRows method returns the data. The returned data is read-only.

If you do not specify a value for the Rows argument, the GetRows method automatically retrieves all the records in the Recordset object. If you request more records than are available, GetRows returns only the number of available records.

If the Recordset object supports bookmarks, you can specify at which record the GetRows method should begin retrieving data by passing the value of that record's Bookmark property.

If you want to restrict the fields the GetRows call returns, you can pass either a single field name/number or an array of field names/numbers in the Fields argument.

After you call GetRows, the next unread record becomes the current record, or the EOF property is set to True if there are no more records.


GetText

Returns a text string from the Clipboard object. Named arguments are not supported.

Syntax

object.GetText (format)

The parts of the GetText method syntax are described in the following table.

Part | Description
object | Required. An object expression that evaluates to an object.
format | Optional. A value or constant that specifies the Clipboard object format, as described in Settings. Parentheses must enclose the constant or value.

Settings

The settings for format are described in the following table:

Constant | Value | Description
vbCFLink | &HBF00 | DDE conversation information
vbCFText | 1 | (Default) Text
vbCFRTF | &HBF01 | Rich Text Format (.rtf file)

Remarks

The only supported data type is UniCode Text.


GetVisibleCount

Returns the number of Node objects that fit in the internal area of a TreeView control.

Syntax

object.GetVisibleCount

The object placeholder represents an object expression that evaluates to an object.

Remarks

The number of Node objects is determined by how many lines can fit in a window. The total number of lines possible is determined by the height of the control and the Size property of the Font object. The count includes the partially visible item at the bottom of the list.

You can use the GetVisibleCount property to make sure that a minimum number of lines are visible so the user can accurately assess a hierarchy. If the minimum number of lines is not visible, you can reset the size of the TreeView using the Height property.

If a particular Node object must be visible, use the EnsureVisible method to scroll and expand the TreeView control.


Hide

Hides a Form object but does not unload it.

Syntax

object.Hide

The object placeholder represents an object expression that evaluates to an object. If object is omitted, the form with the focus is assumed to be object.

Remarks

When a form is hidden, it is removed from the screen and its Visible property is set to False. A hidden form's controls are not accessible to the user and is available to the Timer control events.

When a form is hidden, the user cannot interact with the application until all code in the event procedure that caused the form to be hidden has finished executing.

If the form is not loaded when the Hide method is invoked, the Hide method loads the form but does not display it.


Input, InputB

Returns a string containing characters from a file opened in Input or Binary mode. InputB returns bytes.

Syntax

file.Input(Number)

The parts of the Input and InputB statement syntax are described in the following table.

Part | Description
Number | Any valid numeric expression specifying the number of character to return.

Remarks

Data read with the Input function is usually written to a file with the LinePrint or Put functions. Use this function only with files opened in Input or Binary mode.

Unlike the LineInputString statement, the Input function returns all of the characters it reads, including commas, carriage returns, linefeeds, quotation marks, and leading spaces.

With files opened for Binary access, an attempt to read through the file using the Input function until the EOF function returns True generates an error. Use the LOF and Loc functions instead of EOF when reading binary files with the Input function, or use Get when using the EOF function.

.

Note Use the InputB function for byte data contained within text files. With InputB, number specifies the number of bytes to return rather than the number of characters to return.


InputFields

Reads data from an open sequential file and returns a single dimension Variant array.

Syntax

variant = file.InputFields(Number)

The parts of the InputFields statement syntax are described in the following table.

Part | Description
Number | Number of comma-delimited fields to read from the file.

Remarks

Data read with the InputFields function is usually written to a file with WriteFields. Use this statement only with files opened in Input or Binary mode.

When read, standard string or numeric data is assigned to variables without modification. The following table illustrates how other input data is treated.

Data | Value Assigned to Variable
Delimiting comma or blank line | Empty.
#NULL# | Null.
#TRUE# or #FALSE# | True or False.
#yyyy-mm-dd hh:mm:ss# | The date and/or time represented by the expression.
#ERROR errornumber# | errornumber (variable is a Variant tagged as an error).

Double quotation marks (" ") within input data are ignored.

If you reach the end of the file while you are inputting a data item, the input is terminated and an error occurs.

Note To be able to correctly read data from a file into variables using InputFields, use the WriteFields statement instead of the LinePrint statement to write the data to the files. Using WriteFields ensures each separate data field is properly delimited.


IPmt

Specifies the interest payment for a given period of an annuity based on periodic fixed payments and a fixed interest rate.

Syntax

IPmt(rate, per, nper, pv, fv, type)

The IPmt function has the following named arguments:

rate
Required. Variant specifying interest rate per period. For example, if you obtain a car loan at an annual percentage rate (APR) of 10 percent and make monthly payments, the rate per period is 0.1/12, or 0.0083.
per
Required. Variant specifying payment period in the range 1 through nper.
nper
Required. Variant specifying total number of payment periods in the annuity. For example, if you make monthly payments on a four-year car loan, your loan has a total of 4 * 12 (or 48) payment periods.
pv
Required. Variant specifying present value, or value today, of a series of future payments or receipts. For example, when you borrow money to buy a car, the loan amount is the present value to the lender of the monthly car payments you will make.
fv
Required. Variant specifying future value or cash balance you want after you have made the final payment. For example, the future value of a loan is $0 because that is its value after the final payment. However, if you want to save $50,000 over 18 years for your child's education, then $50,000 is the future value. If omitted, 0 is assumed.
type
Required. Variant specifying when payments are due. Use 0 if payments are due at the end of the payment period, or use 1 if payments are due at the beginning of the period.

Remarks

An annuity is a series of fixed cash payments made over a period of time. An annuity can be a loan (such as a home mortgage) or an investment (such as a monthly savings plan).

The rate and nper arguments must be calculated using payment periods expressed in the same units. For example, if rate is calculated using months, nper must also be calculated using months.

For all arguments, cash paid out (such as deposits to savings) is represented by negative numbers; cash received (such as dividend checks) is represented by positive numbers.


IRR

Specifies the internal rate of return for a series of periodic cash flows (payments and receipts).

Syntax

IRR(values[, guess])

The IRR function has the following named arguments:

value)
Required. Array of Variant specifying cash flow values. The array must contain at least one negative value (a payment) and one positive value (a receipt).
guess
Optional. Variant specifying value you estimate will be returned by IRR. If omitted, guess is 0.1 (10 percent).

Remarks

The internal rate of return is the interest rate received for an investment consisting of payments and receipts that occur at regular intervals.

The IRR function uses the order of values within the array to interpret the order of payments and receipts. Be sure to enter your payment and receipt values in the correct sequence. The cash flow for each period does not have to be fixed, as it is for an annuity.

IRR is calculated by iteration. Starting with the value of guess, IRR cycles through the calculation until the result is accurate to within 0.00001 percent. If IRR cannot find a result after 20 tries, it fails.


Kill

Deletes files from a disk.

Syntax

filesystem.Kill pathname

The required pathname argument is a string expression that specifies one or more file names to be deleted. The pathname may include the directory or folder, and the drive.

Remarks

Kill supports the use of multiple-character (*) and single-character (?) wildcards to specify multiple files.

An error occurs if you try to use the Kill function to delete an open file.


LineInputString

Reads a single line from an open sequential file and assigns it to a String variable.

Syntax

string = file.LineInputString()

Remarks

Data read with LineInputString is usually written from a file with LinePrint.

The LineInputString statement reads from a file one character at a time until it encounters a carriage return (Chr(13)) or carriage return–linefeed (Chr(13) + Chr(10)) sequence. Carriage return–linefeed sequences are skipped rather than appended to the character string.


LinePrint

Writes a single line to an open sequential file.

Syntax

file.LinePrint Output

The parts of the LinePrint statement syntax are described in the following table.

Part | Description
Output | String expression to write to a file.

Remarks

Data written with LinePrint is usually read from a file with LineInputString.

A carriage return–linefeed (Chr(13) + Chr(10)) sequence is appended to the end of the string.


Listen

Creates a socket and sets it in listen mode. This method works only for TCP connections.

Syntax

object.Listen

Remarks

The ConnectionRequest event occurs when there is an incoming connection. When handling ConnectionRequest, the application should use the Accept method to accept the connection.


MIRR

Specifies the modified internal rate of return for a series of periodic cash flows (payments and receipts).

Syntax

MIRR(values, finance_rate, reinvest_rate)

The MIRR function has the following named arguments:

values
Required. Array of Variant specifying cash flow values. The array must contain at least one negative value (a payment) and one positive value (a receipt).
finance_rate
Required. Variant specifying interest rate paid as the cost of financing.
reinvest_rate
Required. Variant specifying interest rate received on gains from cash reinvestment.

Remarks

The modified internal rate of return is the internal rate of return when payments and receipts are financed at different rates. The MIRR function takes into account both the cost of the investment (finance_rate) and the interest rate received on reinvestment of cash (reinvest_rate).

The finance_rate and reinvest_rate arguments are percentages expressed as decimal values. For example, 12 percent is expressed as 0.12.

The MIRR function uses the order of values within the array to interpret the order of payments and receipts. Be sure to enter your payment and receipt values in the correct sequence.


MkDir

Creates a new directory.

Syntax

filesystem.MkDir PathName

The pathname is a string expression that contains the directory name.


Move

Moves a Form or control. Named arguments are not supported.

Syntax

object.Move left, top, width, height

The parts of the Move method syntax are described in the following table.

Part | Description
object | Optional. An object expression that evaluates to an object. If object is omitted, the Form with the focus is assumed to be object.
left | Required. Single-precision value indicating the horizontal coordinate (x-axis) for the left edge of object.
top | Optional. Single-precision value indicating the vertical coordinate (y-axis) for the top edge of object.
width | Optional. Single-precision value indicating the new width of object.
height | Optional. Single-precision value indicating the new height of object.

Remarks

Only the left argument is required. However, to specify any other arguments, you must specify all arguments that appear in the syntax before the argument you want to specify. For example, you cannot specify width without specifying left and top. Any trailing arguments that are unspecified remain unchanged.

For forms and controls in a Frame control, the coordinate system is always in twips. Moving a form on the screen or moving a control in a Frame is always relative to the origin (0,0), which is the upper-left corner. When moving a control on a Form object or in a PictureBox, the coordinate system of the container object is used. The coordinate system or unit of measure is set with the ScaleMode property at design time. You can change the coordinate system at run time with the Scale method.


Move (ADO)

Moves the position of the current record in a Recordset object.

Syntax

recordset.Move NumRecords, Start

The Move method syntax has these parts.

Part | Description
NumRecords | A signed Long expression specifying the number of records the current record position moves.
Start | Optional. A String or Variant that evaluates to a bookmark.

Remarks

If the NumRecords argument is greater than zero, the current record position moves forward (toward the end of the recordset). If NumRecords is less than zero, the current record position moves backward (toward the beginning of the recordset).

If the Move call would move the current record position to a point before the first record, ADO sets the current record to the position before the first record in the recordset (BOF is True). An attempt to move backward when the BOF property is already True generates an error.

If the Move call would move the current record position to a point after the last record, ADO sets the current record to the position after the last record in the recordset (EOF is True). An attempt to move forward when the EOF property is already True generates an error.

Calling the Move method from an empty Recordset object generates an error.

If you pass the Start argument, the move is relative to the record with this bookmark assuming the Recordset object supports bookmarks. If not specified, the move is relative to the current record.

Start can be one of the three special bookmarks defined by the ADO BookmarkEnum, namely:

Constant | Value | Description
adBookmarkCurrent | 0 | Current record (logically equivalent to passing no value for Start)
adBookmarkFirst | 1 | The first record in the recordset
adBookmarkLast | 2 | The last record in the recordset


MoveFile

Renames an existing file or a directory—including all its children

Syntax

filesystem.MoveFile PathName, NewPathName

The parts of the MoveFile function syntax are described in the following table.

Part | Description
PathName | String that contains the file name.
NewPathName | String that contains the file name to copy to.


MoveFirst, MoveLast, MoveNext, MovePrevious

Move to the first, last, next, or previous record in a specified Recordset object and make that record the current record.

Syntax

recordset.{MoveFirst | MoveLast [dbRunAsync] | MoveNext | MovePrevious}

The recordset placeholder is an object variable that represents an open Recordset object.

Remarks

Use the MoveFirst method to move the current record position to the first record in the recordset.

Use the MoveLast method to move the current record position to the last record in the recordset.

Use the MoveNext method to move the current record position one record forward (towards the bottom of the Recordset). If the last record is the current record and you call the MoveNext method, ADO sets the current record to the position after the last record in the Recordset (EOF is True). An attempt to move forward when the EOF property is already True generates an error.

Use the MovePrevious method to move the current record position one record backward (towards the top of the Recordset). If the first record is the current record and you call the MovePrevious method, ADO sets the current record to the position before the first record in the Recordset (BOF is True). An attempt to move backward when the BOF property is already True generates an error.


NPer

Specifies the number of periods for an annuity based on periodic fixed payments and a fixed interest rate.

Syntax

NPer(rate, pmt, pv[, fv[, type]])

The NPer function has the following named arguments:

rate
Required. Variant specifying interest rate per period. For example, if you obtain a car loan at an annual percentage rate (APR) of 10 percent and make monthly payments, the rate per period is 0.1/12, or 0.0083.
pmt
Required. Variant specifying payment to be made each period. Payments usually contain principal and interest that does not change over the life of the annuity.
pv
Required. Variant specifying present value, or value today, of a series of future payments or receipts. For example, when you borrow money to buy a car, the loan amount is the present value to the lender of the monthly car payments you will make.
fv
Optional. Variant specifying future value or cash balance you want after you have made the final payment. For example, the future value of a loan is $0 because that is its value after the final payment. However, if you want to save $50,000 over 18 years for your child's education, then $50,000 is the future value. If omitted, 0 is assumed.
type
Optional. Variant specifying when payments are due. Use 0 if payments are due at the end of the payment period, or use 1 if payments are due at the beginning of the period. If omitted, 0 is assumed.

Remarks

An annuity is a series of fixed cash payments made over a period of time. An annuity can be a loan (such as a home mortgage) or an investment (such as a monthly savings plan).

For all arguments, cash paid out (such as deposits to savings) is represented by negative numbers; cash received (such as dividend checks) is represented by positive numbers.


NPV

Specifies the net present value of an investment based on a series of periodic cash flows (payments and receipts) and a discount rate.

Syntax

NPV(rate, values)

The NPV function has the following named arguments:

rate
Required. Variant specifying discount rate over the length of the period, expressed as a decimal.
values
Required. Array of Variant specifying cash flow values. The array must contain at least one negative value (a payment) and one positive value (a receipt).

Remarks

The net present value of an investment is the current value of a future series of payments and receipts.

The NPV function uses the order of values within the array to interpret the order of payments and receipts. Be sure to enter your payment and receipt values in the correct sequence.

The NPV investment begins one period before the date of the first cash flow value and ends with the last cash flow value in the array.

The net present value calculation is based on future cash flows. If your first cash flow occurs at the beginning of the first period, the first value must be added to the value returned by NPV and must not be included in the cash flow values of values().

The NPV function is similar to the PV function (present value) except that the PV function allows cash flows to begin either at the end or the beginning of a period. Unlike the variable NPV cash flow values, PV cash flows must be fixed throughout the investment.


Open

Opens a file in the mode described by the parameter list.

Syntax

file.Open PathName, Mode, [Access], [Lock], [RecLength]

The parts of the Open statement syntax are described in the following table.

Part | Description
PathName | String expression that specifies a filename.
Mode | Specifies the file mode. Input, Output, Random, Append, or Binary. (1, 2, 4, 8, 32)
Access | Operation permitted on the open file. Read, Write, or ReadWrite [Default]. (1, 2, 3)
Lock | Operations permitted on the open file by other processes. Shared, LockRead, LockWrite [Default], and LockReadWrite. (1, 2, 3, 5)
RecLength | Number less than 32767 (bytes). For files opened for random access, this value is the record length. For sequential files, this value is the number of characters buffered.

Remarks

The RecLength parameter is ignored if mode is Binary.


Open (ADO)

Opens a cursor (read-only by default).

Syntax

recordset.Open Source, ActiveConnection, CursorType, LockType, Options

The parts of the Open statement syntax are described in the following table.

Part | Description
Source | Required. A Variant that evaluates to a table name or a SQL statement (see below).
ActiveConnection | Optional. A Variant that evaluates to a String containing a definition for a connection. If supplied, it can only be "" since this property has no meaning on CE.
CursorType

adOpenForwardOnly 0

adOpenDynamic 2

 Optional. Default adOpenForwardOnly. Supports the following two values. All other values should generate a run-time error.

Forward-only cursor. Identical to a static cursor except that you can only scroll forward through records. This improves performance in situations when you only need to make a single pass through a recordset. (Default.)

Dynamic cursor. Additions, changes, and deletions by other users are visible, and all types of movement through the recordset are allowed, except for bookmarks if the provider doesn't support them. It is extremely important that the default behavior be forward-only, read-only. Note that the forward-only portion maps well to pegdb_autoincrement.
LockType | Optional. A LockTypeEnum value that determines what type of locking (concurrency) the provider should use when opening the Recordset. Can be one of the following constants: adLockReadOnly (1), adLockPessimistic (2), adLockOptimistic (3) or adLockBatchOptimistic. However only adLockReadOnly and adLockOptimistic will be honoured, and all other requests will result in a cursor type of adLockOptimistic.
Options | Optional. A CommandTypeEnum value that indicates how the provider should evaluate the Source argument.

Sets or returns one of the following CommandTypeEnum values:

Constant | Value | Description
adCmdText | 1 | Evaluates Source as a textual definition of a command (i.e. SQL statement)
adCmdTable | 2 | Evaluates Source as a table name.
adCmdUnknown | 8 | The type of command in the Source property is not known. (Default.)

Remarks

Use the Options parameter to optimize evaluation of the Source property. If the Options property value equals adCmdUnknown (8), you may experience diminished performance because ADO must determine if the Source property by attempting to open as a table, stored procedure or as an SQL statement (in that order). If you know what type of command you're using, setting the Options property instructs ADO to go directly to the relevant code. If the Options property does not match the type of command in the Source property, an error occurs when you call the Open method.

When the Open method is called with a non-row returning SQL command (e.g. CREATE TABLE), no recordset is returned and the state of the recordset is closed.

The adLockReadOnly will have to be coded into ADO as PegDB doesn't support the concept of opening a table read-only.


PMT

Specifies the payment for an annuity based on periodic fixed payments and a fixed interest rate.

Syntax

Pmt(rate, nper, pv[, fv[, type]])

The Pmt function has the following named arguments:

rate
Required. Variant specifying interest rate per period. For example, if you obtain a car loan at an annual percentage rate (APR) of 10 percent and make monthly payments, the rate per period is 0.1/12, or 0.0083.
nper
Required. Variant specifying total number of payment periods in the annuity. For example, if you make monthly payments on a four-year car loan, your loan has a total of 4 * 12 (or 48) payment periods.
pv
Required. Variant specifying present value (or lump sum) that a series of payments to be paid in the future is worth now. For example, when you borrow money to buy a car, the loan amount is the present value to the lender of the monthly car payments you will make.
fv
Optional. Variant specifying future value or cash balance you want after you have made the final payment. For example, the future value of a loan is $0 because that is its value after the final payment. However, if you want to save $50,000 over 18 years for your child's education, then $50,000 is the future value. If omitted, 0 is assumed.
type
Optional. Variant specifying when payments are due. Use 0 if payments are due at the end of the payment period, or use 1 if payments are due at the beginning of the period. If omitted, 0 is assumed.

Remarks

An annuity is a series of fixed cash payments made over a period of time. An annuity can be a loan (such as a home mortgage) or an investment (such as a monthly savings plan).

The rate and nper arguments must be calculated using payment periods expressed in the same units. For example, if rate is calculated using months, nper must also be calculated using months.

For all arguments, cash paid out (such as deposits to savings) is represented by negative numbers; cash received (such as dividend checks) is represented by positive numbers.


Point

Returns, as a long integer, the red-green-blue (RGB) color of the specified point on a Form. Named arguments are not supported.

Syntax

object.Point(x, y)

The parts of the Point method syntax are described in the following table.

Part | Description
x, y | Required. Single-precision values indicating the horizontal (x-axis) and vertical (y-axis) coordinates of the point in the ScaleMode property of the Form. Parentheses must enclose the values.

Remarks

If the point referred to by the x and y coordinates is outside object, the Point method returns -1.


PointSet

Returns, as a long integer, the red-green-blue (RGB) color of the specified point on a Form. Named arguments are not supported.

Syntax

object.PointSet x, y, color

The parts of the PointSet method syntax are described in the following table.

Part | Description
object | Optional. An object expression that evaluates to an object. If object is omitted, the Form object with the focus is assumed to be object.
x, y | Required. Single-precision values indicating the horizontal (x-axis) and vertical (y-axis) coordinates of the point in the ScaleMode property of the Form.
color | Required.

Remarks

If the point referred to by the x and y coordinates is outside object, the PointSet method returns -1.


PPmt

Specifies the principal payment for a given period of an annuity based on periodic fixed payments and a fixed interest rate.

Syntax

PPmt(variant rate, variant per, variant nper, variant pv, [optional]VARIANT fv, variant* due, [out, retval] variant* value);

PPmt(rate, per, nper, pv[, fv[, type]])

The PPmt function has the following named arguments:

rate
Required. Variant specifying interest rate per period. For example, if you obtain a car loan at an annual percentage rate (APR) of 10 percent and make monthly payments, the rate per period is 0.1/12, or 0.0083.
per
Required. Variant specifying payment period in the range 1 through nper.
nper
Required. Variant specifying total number of payment periods in the annuity. For example, if you make monthly payments on a four-year car loan, your loan has a total of 4 * 12 (or 48) payment periods.
pv
Required. Variant specifying present value, or value today, of a series of future payments or receipts. For example, when you borrow money to buy a car, the loan amount is the present value to the lender of the monthly car payments you will make.
fv
Optional. Variant specifying future value or cash balance you want after you have made the final payment. For example, the future value of a loan is $0 because that is its value after the final payment. However, if you want to save $50,000 over 18 years for your child's education, then $50,000 is the future value. If omitted, 0 is assumed.
type
Required. Variant specifying when payments are due. Use 0 if payments are due at the end of the payment period, or use 1 if payments are due at the beginning of the period. If omitted, 0 is assumed.

Remarks

An annuity is a series of fixed cash payments made over a period of time. An annuity can be a loan (such as a home mortgage) or an investment (such as a monthly savings plan).

The rate and nper arguments must be calculated using payment periods expressed in the same units. For example, if rate is calculated using months, nper must also be calculated using months.

For all arguments, cash paid out (such as deposits to savings) is represented by negative numbers; cash received (such as dividend checks) is represented by positive numbers.


Put

Writes data from a variable to a disk file.

Syntax

file.Put Data, [Recnumber]

The parts of the Put statement syntax are described in the following table.

Part | Description
Data | Required. Variant variable containing data to be written to disk.
Recnumber | Optional. Variant (Long). Record number (Random mode files) or byte number (Binary mode files) at which writing begins.

Remarks

Data written with Put is usually read from a file with Get.

The first record or byte in a file is at position 1, the second record or byte is at position 2, and so on. If you omit recnumber, the next record or byte after the last Get or Put statement or pointed to by the last Seek function is written.

For files opened in Random mode, the following rules apply:

  • If the length of the data being written is less than the length specified in the Len clause of the Open statement, Put writes subsequent records on record-length boundaries. The space between the end of one record and the beginning of the next record is padded with the existing contents of the file buffer. Because the amount of padding data cannot be determined with any certainty, it is generally a good idea to have the record length match the length of the data being written. If the length of the data being written is greater than the length specified in the Len clause of the Open statement, an error occurs.
  • If the variable being written is a Variant of a numeric type, Put writes 2 bytes identifying the VarType of the Variant and then writes the variable. For example, when writing a Variant of VarType 3, Put writes 6 bytes: 2 bytes identifying the Variant as VarType 3 (Long) and 4 bytes containing the Long data. The record length specified by the Len clause in the Open statement must be at least 2 bytes greater than the actual number of bytes required to store the variable.

You can use the Put statement to write a Variant array to disk, but you cannot use Put to write a scalar Variant containing an array to disk. You also cannot use Put to write objects to disk.

  • If the variable being written is a Variant of VarType 8 (String), Put writes 2 bytes identifying the VarType, 2 bytes indicating the length of the string, and then writes the string data. The record length specified by the Len clause in the Open statement must be at least 4 bytes greater than the actual length of the string.
  • If the variable being written is a dynamic array, Put writes a descriptor whose length equals 2 plus 8 times the number of dimensions, that is, 2 + 8 * NumberOfDimensions. The record length specified by the Len clause in the Open statement must be greater than or equal to the sum of all the bytes required to write the array data and the array descriptor. For example, the following array declaration requires 118 bytes when the array is written to disk.
  • For files opened in Binary mode, all of the Random rules apply, except:
    • The Len clause in the Open statement has no effect. Put writes all variables to disk contiguously; that is, with no padding between records.


PV

Specifies the present value of an annuity based on periodic fixed payments to be paid in the future and a fixed interest rate.

Syntax

PV(rate, nper, pmt[, fv[, type]])

The PV function has the following named arguments:

rate
Required. Variant specifying interest rate per period. For example, if you obtain a car loan at an annual percentage rate (APR) of 10 percent and make monthly payments, the rate per period is 0.1/12, or 0.0083.
nper
Required. Variant specifying total number of payment periods in the annuity. For example, if you make monthly payments on a four-year car loan, your loan has a total of 4 * 12 (or 48) payment periods.
pmt
Required. Variant specifying payment to be made each period. Payments usually contain principal and interest that does not change over the life of the annuity.
fv
Optional. Variant specifying future value or cash balance you want after you have made the final payment. For example, the future value of a loan is $0 because that is its value after the final payment. However, if you want to save $50,000 over 18 years for your child's education, then $50,000 is the future value. If omitted, 0 is assumed.
type
Optional. Variant specifying when payments are due. Use 0 if payments are due at the end of the payment period, or use 1 if payments are due at the beginning of the period. If omitted, 0 is assumed.

Remarks

An annuity is a series of fixed cash payments made over a period of time. An annuity can be a loan (such as a home mortgage) or an investment (such as a monthly savings plan).

The rate and nper arguments must be calculated using payment periods expressed in the same units. For example, if rate is calculated using months, nper must also be calculated using months.

For all arguments, cash paid out (such as deposits to savings) is represented by negative numbers; cash received (such as dividend checks) is represented by positive numbers.


Raise

Generates a run-time error.

Syntax

object.Raise number, source, description, helpfile, helpcontext

The object qualifier and named arguments of the Raise method are described in the following table.

Argument | Description
object | Required. Always the Err object.
number | Required. Long integer that identifies the nature of the error. Visual Basic errors (both Visual Basic-defined and user-defined errors) are in the range 0–65535. When setting the Number property to your own error code in a class module, you add your error code number to the vbObjectError constant. For example, to generate the error number 1050, assign vbObjectError + 1050 to the Number property.
source | Optional. String expression naming the object or application that generated the error. When setting this property for an object, use the form project.class. If source is not specified, the programmatic ID of the current Visual Basic project is used.
description | Optional. String expression describing the error. If unspecified, the value in the Number property is examined. If it can be mapped to a Visual Basic run-time error code, the string that would be returned by the Error function is used as Description. If there is no Visual Basic error corresponding to the Number property, the "Application-defined or object-defined error" message is used.
helpfile | Not supported.
helpcontext | Not supported.

Remarks

All of the arguments are optional except number. If you use Raise without specifying some arguments, and the property settings of the Err object contain values that have not been cleared, those values serve as the values for your error.

Raise is used for generating run-time errors and can be used instead of the Error statement. Raise is useful for generating errors when writing class modules, because the Err object gives richer information than is possible if you generate errors with the Error statement.


Rate

Specifies the interest rate per period for an annuity.

Syntax

Rate(nper, pmt, pv[, fv[, type[, guess]]])

The Rate function has the following named arguments:

nper
Required. Variant specifying total number of payment periods in the annuity. For example, if you make monthly payments on a four-year car loan, your loan has a total of 4 * 12 (or 48) payment periods.
pmt
Required. Variant specifying payment to be made each period. Payments usually contain principal and interest that does not change over the life of the annuity.
pv
Required. Variant specifying present value, or value today, of a series of future payments or receipts. For example, when you borrow money to buy a car, the loan amount is the present value to the lender of the monthly car payments you will make.
fv
Optional. Variant specifying future value or cash balance you want after you make the final payment. For example, the future value of a loan is $0 because that is its value after the final payment. However, if you want to save $50,000 over 18 years for your child's education, then $50,000 is the future value. If omitted, 0 is assumed.
type
Optional. Variant specifying a number indicating when payments are due. Use 0 if payments are due at the end of the payment period, or use 1 if payments are due at the beginning of the period. If omitted, 0 is assumed.
guess
Optional. Variant specifying value you estimate will be returned by the Rate function. If omitted, guess is 0.1 (10 percent).

Remarks

An annuity is a series of fixed cash payments made over a period of time. An annuity can be a loan (such as a home mortgage) or an investment (such as a monthly savings plan).

For all arguments, cash paid out (such as deposits to savings) is represented by negative numbers; cash received (such as dividend checks) is represented by positive numbers.

Rate is calculated by iteration. Starting with the value of guess, the Rate function cycles through the calculation until the result is accurate to within 0.00001 percent. If Rate cannot find a result after 20 tries, it fails. If your guess is 10 percent and Rate fails, try a different value for guess.


Refresh

Forces a complete repaint of a Form or control.

Syntax

object.Refresh

The object placeholder represents an object expression that evaluates to an object.

Remarks

Use the Refresh method when you want to:

  • Completely display one form while another form loads.

You cannot use Refresh on Menu or Timer controls.

Generally, painting a form or control is handled automatically while no events are occurring. However, there may be situations where you want the form or control updated immediately. For example, if you use a file list box, a directory list box, or a drive list box to show the current status of the directory structure, you can use Refresh to update the list whenever a change is made to the directory structure.


Remove

Remove removes an image from the ImageList.

Syntax

Object.Remove (index)

Remarks

It is passed the index of an image to remove. The image data is lost. It returns the new number of images in the list.


RemoveAll

RemoveAll removes an image from the ImageList.

Syntax

Object.RemoveAll ()

Remarks

RemoveAll is the same as setting Count to zero. All other information, such as ImageWidth and ImageHeight, is preserved.


RemoveItem

Removes an item from a ListBox or ComboBox or from a Grid control. Named arguments are not supported.

Syntax

object.RemoveItem index

The parts of the RemoveItem method syntax are described in the following table.

Part | Description
object | Required. An object expression that evaluates to an object.
index | Required. Integer representing the position within the object of the item or row to remove. For the first item in a ListBox or ComboBox or for the first row in a Grid control, index = 0.

Remarks

A ListBox or ComboBox that is bound to a Data control doesn't support the RemoveItem method.

The RemoveItem method for the Grid control, deletes the entire row specified. To clear data without removing the rows themselves, use the Clear method.


Replace

Replace replaces an image in an ImageList.

Syntax

Object.Replace (index)

Remarks

Replace is passed the index of a valid image file to load, and returns the number of images in the ImageList.


Reset

Reset removes all images from the ImageList and resets all other information.

Syntax

Object.Reset ()

Remarks

Reset clears the ImageWidth and ImageHeight entries, allowing the control to be used with differently sized images.


RmDir

Deletes an existing empty directory.

Syntax

filesystem.RmDir PathName

The parts of the RmDir function syntax are described in the following table.

Part | Description
PathName | String that contains the directory name.


ScaleX

Converts the value for the width or height of a Form, PictureBox, or Printer from one of the ScaleMode property's unit of measure to another. Named arguments are not supported.

Syntax

object.ScaleX (width, fromscale, toscale)

object.ScaleY (height, fromscale, toscale)

The parts of the ScaleX and ScaleY method syntaxes are described in the following table.

Part | Description
object | Optional. An object expression that evaluates to an object. If object is omitted, the Form object with the focus is assumed to be object.
width | Required. Specifies, for object, the number of units of measure to be converted.
height | Required. Specifies, for object, the number of units of measure to be converted.
fromscale | Optional. A constant or value specifying the coordinate system from which width or height of object is to be converted, as described in Settings. The possible values of fromscale are the same as for the ScaleMode property, plus the new value of HiMetric.
toscale | Optional. A constant or value specifying the coordinate system to which width or height of object is to be converted, as described in Settings. The possible values of toscale are the same as for the ScaleMode property, plus the new value of HiMetric.

The settings for fromscale and toscale are described in the following table.

Constant | Value | Description
vbUser | 0 | User-defined: indicates that the width or height of object is set to a custom value.
vbTwips | 1 | Twip (1440 twips per logical inch; 567 twips per logical centimeter).
vbPoints | 2 | Point (72 points per logical inch).
vbPixels | 3 | Pixel (smallest unit of monitor or printer resolution).
vbCharacters | 4 | Character (horizontal = 120 twips per unit; vertical = 240 twips per unit).
vbInches | 5 | Inch.
vbMillimeters | 6 | Millimeter.
vbCentimeters | 7 | Centimeter.
vbHimetric | 8 | HiMetric. If fromscale is omitted, HiMetric is assumed as the default.
vbContainerPosition | 9 | Determines control's position.
vbContainerSize | 10 | Determines control's size.

Remarks

The ScaleX and ScaleY methods take a value (width or height), with its unit of measure specified by fromscale, and convert it to the corresponding value for the unit of measure specified by toscale.

You can also use ScaleX and ScaleY with the PaintPicture method.


ScaleY

Converts the value for the width or height of a Form, PictureBox, or Printer from one of the ScaleMode property's unit of measure to another. Named arguments are not supported.

Syntax

object.ScaleX (width, fromscale, toscale)

object.ScaleY (height, fromscale, toscale)

The parts of the ScaleX and ScaleY method syntaxes are described in the following table.

Part | Description
object | Optional. An object expression that evaluates to an object. If object is omitted, the Form object with the focus is assumed to be object.
width | Required. Specifies, for object, the number of units of measure to be converted.
height | Required. Specifies, for object, the number of units of measure to be converted.
fromscale | Optional. A constant or value specifying the coordinate system from which width or height of object is to be converted, as described in Settings. The possible values of fromscale are the same as for the ScaleMode property, plus the new value of HiMetric.
toscale | Optional. A constant or value specifying the coordinate system to which width or height of object is to be converted, as described in Settings. The possible values of toscale are the same as for the ScaleMode property, plus the new value of HiMetric.

The settings for fromscale and toscale are described in the following table.

Constant | Value | Description
vbUser | 0 | User-defined: indicates that the width or height of object is set to a custom value.
vbTwips | 1 | Twip (1440 twips per logical inch; 567 twips per logical centimeter).
vbPoints | 2 | Point (72 points per logical inch).
vbPixels | 3 | Pixel (smallest unit of monitor or printer resolution).
vbCharacters | 4 | Character (horizontal = 120 twips per unit; vertical = 240 twips per unit).
vbInches | 5 | Inch.
vbMillimeters | 6 | Millimeter.
vbCentimeters | 7 | Centimeter.
vbHimetric | 8 | HiMetric. If fromscale is omitted, HiMetric is assumed as the default.
vbContainerPosition | 9 | Determines control's position.
vbContainerSize | 10 | Determines control's size.

Remarks

The ScaleX and ScaleY methods take a value (width or height), with its unit of measure specified by fromscale, and convert it to the corresponding value for the unit of measure specified by toscale.

You can also use ScaleX and ScaleY with the PaintPicture method.


SendData

Sends data to a remote computer. SendData only supports BSTRs and arrays of integers.

Syntax

object.SendData data

The parts of the SendData method syntax are described in the following table.

Part | Description
object | An object expression that evaluates to an object.
data | Data may be a string or an array of imtegers.


SetAttr

Sets attribute information for a file.

Syntax

SetAttr pathname, attributes

The named arguments of the SetAttr statement syntax are described in the following table.

Part | Description
pathname | Required. String expression that specifies a file name—may include directory or folder, and drive.
attributes | Required. Numeric expression, whose sum specifies file attributes.

The attributes argument settings are described in the following table.

Constant | Value | Description
vbNormal | 0 | Normal (default.)
vbReadOnly | 1 | Read-only.
vbHidden | 2 | Hidden.
vbSystem | 4 | System file.
vbArchive | 32 | File has changed since last backup.

Remarks

A run-time error occurs if you try to set the attributes of an open file.


SetFocus

Moves the focus to the specified control or form.

Syntax

object.SetFocus

The object placeholder represents an object expression that evaluates to an object.

Remarks

The object must be a Form object, or control that can receive the focus. After invoking the SetFocus method, any user input is directed to the specified form or control.

You can only move the focus to a visible form or control. Because a form and controls on a form are not visible until the form's Load event has finished, you cannot use the SetFocus method to move the focus to the form being loaded in its own Load event unless you first use the Show method to show the form before the Form_Load event procedure is finished.

You also cannot move the focus to a form or control if the Enabled property is set to False. If the Enabled property has been set to False at design time, you must first set it to True before it can receive the focus using the SetFocus method.


SetScale

Defines the coordinate system for a Form, PictureBox, or Printer. Named arguments are not supported.

Syntax

object.SetScale x1, y1, x2, y2

The parts of the SetScale method syntax are described in the following table.

Part | Description
x1 | Optional. An object expression that evaluates to an object. If object is omitted, the Form object with the focus is assumed to be object.
y1 | Optional. Single-precision values indicating the horizontal (x-axis) and vertical (y-axis) coordinates that define the upper-left corner of object. Parentheses must enclose the values. If omitted, the second set of coordinates must also be omitted.
x2 | Optional. Single-precision values indicating the horizontal and vertical coordinates that define the lower-right corner of object. . If omitted, the first set of coordinates must also be omitted.
y2 | Optional.

The SetScale method enables you to reset the coordinate system to any scale you choose. SetScale affects the coordinate system for both run-time graphics statements and the placement of controls.

If you use SetScale with no arguments (both sets of coordinates omitted), it resets the coordinate system to twips.


SetText

Puts a text string on the Clipboard object using the specified Clipboard object format. Named arguments are not supported.

Syntax

object.SetText data, format

The parts of the SetText method syntax are described in the following table.

Part | Description
object | Required. An object expression that evaluates to an object.
data | Required. String data to be placed onto the Clipboard.
format | Optional. A constant or value that specifies one of the Clipboard formats recognized by Visual Basic, as described in Settings.

Settings

The settings for format are described in the following table.

Constant | Value | Description
vbCFLink | &HBF00 | DDE conversation information
vbCFText | 1 | (Default) Text

Remarks

The only supported data type is UniCode Text.


Show

Displays a Form object.

Syntax

object.Show

The parts of the Show method syntax are described in the following table.

Part | Description
object | Optional. An object expression that evaluates to an object. If object is omitted, the form associated with the active form module is assumed to be object.

Remarks

If the specified form is not loaded when the Show method is invoked, Visual Basic automatically loads it.

The startup form of an application is automatically shown after its Load event is invoked.


ShowColor

Displays the CommonDialog control's Color dialog box..

Syntax

object.ShowColor

The object placeholder represents an object expression that evaluates to an object.


ShowFont

Displays the CommonDialog control's Font dialog box..

Syntax

object.ShowFont

The object placeholder represents an object expression that evaluates to an object.


ShowHelp

Runs PegHelp.exe and displays the Help file you specify.

Syntax

object.ShowHelp

The object placeholder represents an object expression that evaluates to an object.


ShowOpen

Displays the CommonDialog control's Open dialog box..

Syntax

object.ShowOpen

The object placeholder represents an object expression that evaluates to an object.


ShowSave

Displays the CommonDialog control's Save As dialog box..

Syntax

object.ShowSave

The object placeholder represents an object expression that evaluates to an object.


SLN

Specifies the straight-line depreciation of an asset for a single period.

Syntax

SLN(cost, salvage, life)

The SLN function has the following named arguments:

cost
Required. Variant specifying initial cost of the asset.
salvage
Required. Variant specifying value of the asset at the end of its useful life.
life
Required. Variant specifying length of the useful life of the asset.

Remarks

The depreciation period must be expressed in the same unit as the life argument. All arguments must be positive numbers.


StartLabelEdit

Enables a user to edit a label.

Syntax

object.StartLabelEdit

The object placeholder represents an object expression that evaluates to an object.

Remarks

The StartLabelEdit method must be used to initiate a label editing operation when the LabelEdit property is set to 1 (Manual).

When the StartLabelEdit method is invoked upon an object, the BeforeLabelEdit event is also generated.


SYD

Specifies the sum-of-years' digits depreciation of an asset for a specified period.

Syntax

SYD(cost, salvage, life, period)

The SYD function has the following named arguments:

cost
Required. Variant specifying initial cost of the asset.
salvage
Required. Variant specifying value of the asset at the end of its useful life.
life
Required. Variant specifying length of the useful life of the asset.
period
Required. Variant specifying period for which asset depreciation is calculated.

Remarks

The life and period arguments must be expressed in the same units. For example, if life is given in months, period must also be given in months. All arguments must be positive numbers.


TextHeight

Returns the height of a text string as it would be printed in the current font of a Form, PictureBox, or Printer. Named arguments are not supported.

Syntax

object.TextHeight (string)

The parts of the TextHeight method syntax are described in the following table.

Part | Description
object | Optional. An object expression that evaluates to an object. If object is omitted, the Form object with the focus is assumed to be object.
string | Required. A string expression that evaluates to a string for which the text height is determined. Parentheses must enclose the string expression.

Remarks

The height is expressed in terms of the ScaleMode property setting or Scale method coordinate system in effect for object. Use TextHeight to determine the amount of vertical space required to display the text. The height returned includes the normal leading space above and below the text, so you can use the height to calculate and position multiple lines of text within object.

If string contains embedded carriage returns, TextHeight returns the cumulative height of the lines, including the leading space above and below each line.


TextWidth

Returns the width of a text string as it would be printed in the current font of a Form, PictureBox, or Printer. Named arguments are not supported.

Syntax

object.TextWidth(string)

The parts of the TextWidth method syntax are described in the following table.

Part | Description
object | Optional. An object expression that evaluates to an object. If object is omitted, the Form with the focus is assumed to be object.
string | Required. A string expression that evaluates to a string for which the text width is determined. Parentheses must surround the string expression.

Remarks

The width is expressed in terms of the ScaleMode property setting or Scale method coordinate system in effect for object. Use TextWidth to determine the amount of horizontal space required to display the text. If string contains embedded carriage returns, TextWidth returns the width of the longest line.


Update

Saves any changes you make to the current record of a Recordset object.

recordset.Update Fields, Values

Part | Description
Fields | Optional. A Variant representing a single name or a Variant array representing names or ordinal positions of the field or fields in the new record.
Values | Optional. A Variant representing a single value or a Variant array representing values for the field or fields in the new record.

Remarks

Use the Update method to save any changes you make to the current record of a Recordset object since calling the AddNew method or since changing any field values in an existing record. The Recordset object must support updates.

To set field values, do one of the following:

  • Assign values to a Field object's Value property and call the Update method.
  • Pass a field name and a value as arguments with the Update call.
  • Pass an array of field names and an array of values with the Update call.

When you use arrays of fields and values, there must be an equal number of elements in both arrays. Also, the order of field names must match the order of field values. If the number and order of fields and values do not match, an error occurs.

If you move from the record you are adding or editing before calling the Update method, ADO will automatically call Update to save the changes. You must call the CancelUpdate method if you want to cancel any changes made to the current record or to discard a newly added record.

The current record remains current after you call the Update method.


WriteFields

Writes data to a sequential file.

Syntax

file.WriteFields [Data]

The parts of the WriteFields statement syntax are described in the following table.

Part | Description
Data | Variant or Variant array of numeric or string expressions to write to a file.

Remarks

Data written with WriteFields is usually read from a file with InputFields.

If you omit Data, a blank line is printed to the file.

When WriteFields is used to write data to a file, several universal assumptions are followed so the data can always be read and correctly interpreted using InputFields, regardless of locale:

  • Numeric data is always written using the period as the decimal separator.
  • For Boolean data, either #TRUE# or #FALSE# is printed. The True and False keywords are not translated, regardless of locale.
  • Date data is written to the file using the universal date format. When either the date or the time component is missing or zero, only the part provided gets written to the file.
  • Nothing is written to the file if Data is Empty. However, for Null data, #NULL# is written.
  • If Data is Null, #NULL# is written to the file.
  • For Error data, the output appears as #ERROR errorcode#. The Error keyword is not translated, regardless of locale.

The WriteFields statement inserts commas between items and quotation marks around strings as they are written to the file. You do not have to put explicit delimiters in the list. WriteFields inserts a newline character, that is, a carriage return–linefeed (Chr(13) + Chr(10)), after it has written the final character in Data to the file.


ZOrder

Places a specified Form, or control at the front or back of the z-order within its graphical level. Named arguments are not supported.

Syntax

object.ZOrder position

The parts of the ZOrder method syntax are described in the following table.

Part | Description
object | Optional. An object expression that evaluates to an object. If object is omitted, the form with the focus is assumed to be object.
position | Optional. Integer indicating the position of object relative to other instances of the same object. If position is 0 or omitted, object is positioned at the front of the z-order. If position is 1, object is positioned at the back of the z-order.

Remarks

The z-order of objects can be set at design time by choosing the Bring To Front or Send To Back menu command from the Edit menu.

Three graphical layers are associated with forms and containers. The back layer is the drawing space where the results of the graphics methods are displayed. Next is the middle layer where graphical objects and Label controls are displayed. The front layer is where all nongraphical controls like CommandButton, CheckBox, or ListBox are displayed. Anything contained in a layer closer to the front covers anything contained in the layer(s) behind it. ZOrder arranges objects only within the layer where the object is displayed.


Events

Events

Activate

AfterLabelEdit

BeforeLabelEdit

Change

Click

Close

Collapse

ColumnClick

Compare

ConnectionRequest

DataArrival

DblClick

Deactivate

DropDown

EnterCell

Error

Expand

GotFocus

ItemCheck

KeyDown, KeyUp

KeyPress

LeaveCell

Load

LostFocus

MouseDown, MouseUp

MouseMove

NodeClick

OnComm

Paint

QueryUnload

Resize

RowColChange

Scroll

Scroll (Grid)

SelChange

SendComplete

SendProgress

Terminate

Timer

Unload


Activate

  • Activate—occurs when an object becomes the active window.
  • Deactivate — occurs when an object is no longer the active window.

Syntax

Private Sub object_Activate( )

Private Sub object_Deactivate( )

The object placeholder represents an object expression that evaluates to an object.

Remarks

An object can become active by user action, such as clicking it, or by using the Show or SetFocus methods in code.

The Activate event can occur only when an object is visible. For example, a form loaded with the Load statement is not visible unless you use the Show method or set the form's Visible property to True.

The Activate and Deactivate events occur only when moving the focus within an application. Moving the focus to or from an object in another application does not trigger either event. The Deactivate event does not occur when unloading an object.

The Activate event occurs before the GotFocus event; the LostFocus event occurs before the Deactivate event.


AfterLabelEdit

The AfterLabelEdit event occurs after a user edits the label of the currently selected Node or ListItem object.

Syntax

Private Sub object_AfterLabelEdit (newstring)

The AfterLabelEdit event syntax has these parts:

Part | Description
object | An object expression that evaluates to an object.
newstring | The string the user entered, or Null if the user canceled the operation.

Remarks

Both the AfterLabelEdit and the BeforeLabelEdit events are generated only if the LabelEdit property is set to 0 (Automatic), or if the StartLabelEdit method is invoked.

The AfterLabelEdit event is generated after the user finishes the editing operation, which occurs when the user clicks on another Node or ListItem, or presses the ENTER key.


BeforeLabelEdit

The BeforeLabelEdit event occurs when a user attempts to edit the label of the currently selected Node or ListItem object.

Syntax

Private Sub object_BeforeLabelEdit(newstring)

The BeforeLabelEdit event syntax has these parts:

Part | Description
object | An object expression that evaluates to an object.

Remarks

Both the AfterLabelEdit and the BeforeLabelEdit events are generated only if the LabelEdit property is set to 0 (Automatic), or if the StartLabelEdit method is invoked.

The BeforeLabelEdit event occurs after the standard Click event.

To begin editing a label, the user must first click the object to select it, and click it a second time to begin the operation. The BeforeLabelEdit event occurs after the second click.

To determine which object's label is being edited, use the SelectedItem property.


Change

Indicates the contents of a control have changed. How and when this event occurs varies with the control:

  • ComboBox — changes the text in the text box portion of the control. Occurs only if the Style property is set to 0 (Dropdown Combo) or 1 (Simple Combo) and the user changes the text or you change the Text property setting through code.
  • HScrollBar and VScrollBar (horizontal and vertical scroll bars) — move the scroll box portion of the scroll bar. Occurs when the user scrolls or when you change the Value property setting through code.
  • Label — changes the contents of the Label. Occurs when a DDE link updates data or when you change the Caption property setting through code.
  • TextBox — changes the contents of the text box. Occurs when a DDE link updates data, when a user changes the text, or when you change the Text property setting through code.
  • Slider — generated when the Value property changes, either through code, or when the user moves the control's slider.
  • Toolbar — generated after the end user customizes a Toolbar control's toolbar using the Customize Toolbar dialog box.

Syntax

Private Sub object.Change([index])

The Change event syntax has these parts:

Part | Description
object | An object expression that evaluates to an object.
index | An integer that uniquely identifies a control.

Remarks

The Change event procedure can synchronize or coordinate data display among controls. For example, you can use a scroll bar's Change event procedure to update the scroll bar's Value property setting in a TextBox control. Or you can use a Change event procedure to display data and formulas in a work area and results in another area.

Note A Change event procedure can sometimes cause a cascading event. This occurs when the control's Change event alters the control's contents, for example, by setting a property in code that determines the control's value, such as the Text property setting for a TextBox control. To prevent a cascading event:

  • If possible, avoid writing a Change event procedure for a control that alters that control's contents. If you do write such a procedure, be sure to set a flag that prevents further changes while the current change is in progress.
  • Avoid creating two or more controls whose Change event procedures affect each other, for example, two TextBox controls that update each other during their Change events.
  • Avoid using a MsgBox function or statement in this event for HScrollBar and VScrollBar controls.


Click

Occurs when the user presses and then releases a mouse button over an object. It can also occur when the value of a control is changed.

For a Form object, this event occurs when the user clicks either a blank area or a disabled control. For a control, this event occurs when the user:

  • Clicks a control with the left or right mouse button. With a CheckBox, CommandButton, Listbox, or OptionButton control, the Click event occurs only when the user clicks the left mouse button.
  • Selects an item in a ComboBox or ListBox control, either by pressing the arrow keys or by clicking the mouse button.
  • Presses the SPACEBAR when a CommandButton, OptionButton, or CheckBox control has the focus.
  • Presses ENTER when a form has a CommandButton control with its Default property set to True.
  • Presses ESC when a form has a Cancel button — a CommandButton control with its Cancel property set to True.
  • Presses an access key for a control. For example, if the caption of a CommandButton control is "&Go", pressing ALT+G triggers the event.

You can also trigger the Click event in code by:

  • Setting a CommandButton control's Value property to True.
  • Setting an OptionButton control's Value property to True.
  • Changing a CheckBox control's Value property setting.

Syntax

Private Sub Form_Click( )

Private Sub object_Click([index])

Part | Description
object | An object expression that evaluates to an object.
index | An integer that uniquely identifies a control.

Remarks

Typically, you attach a Click event procedure to a CommandButton control, Menu object, or a PictureBox control to carry out commands and command-like actions. For the other applicable controls, use this event to trigger actions in response to a change in the control.

You can use a control's Value property to test the state of the control from code. Clicking a control generates MouseDown and MouseUp events in addition to the Click event. The order in which these three events occur varies from control to control.

For example, for ListBox and CommandButton controls, the events occur in this order:

MouseDown, Click, MouseUp.

But for Label, or PictureBox controls, the events occur in this order:

MouseDown, MouseUp, Click.

When you are attaching event procedures for these related events, be sure that their actions do not conflict. If the order of events is important in your application, test the control to determine the event order.

If there is code in the Click event, the DlbClick event will never trigger, because the Click event is the first event to trigger between the two. As a result, the mouse click is intercepted by the Click event, so the DblClick event does not occur.


Close

Occurs when the remote computer closes the connection. Applications should use the Close method to correctly close a TCP connection.

Syntax

object_Close( )

The object placeholder represents an object expression that evaluates to an object.

Arguments

None.


Collapse

The Collapse event occurs when any Node object in a TreeView control is collapsed.

Syntax

Private Sub object_Collapse (node[index])

The Collapse event syntax has these parts:

Part | Description
object | An object expression that evaluates to an object.
node | A reference to the collapsed Node object.

Remarks

The Collapse event occurs before the standard Click event. There are three methods of collapsing a Node: by setting the Node object's Expanded property to False, by double-clicking a Node object, and by clicking a plus/minus image when the TreeView control's Style property is set to a style that includes plus/minus images. All of these methods generate the Collapse event.


ColumnClick

Occurs when a ColumnHeader object in a ListView control is clicked. Only available in Report view.

Syntax

Private Sub object_ColumnClick(columnheader[index])

The ColumnClick event syntax has these parts:

Part | Description
object | An object expression that evaluates to a ListView control.
columnheader | A reference to the ColumnHeader object that was clicked.

Remarks

The Sorted, SortKey, and SortOrder properties are commonly used in code to sort the ListItem objects in the clicked column.


Compare

Occurs when the Sort property for the Grid control is set to Custom Sort (9) so the user can customize the sort process.

Syntax

Private Sub object_Compare(row1, row2)

The Compare event syntax has these parts:

Part | Description
object | An object expression that evaluates to an object.
row1 | A Long representing the first row in a pair of rows being compared.
row2 | A Long representing the second row in a pair of rows being compared

Settings

The event handler must compare rows row1 and row2.

Setting | Description
–1 | If row1 should appear before row2.
0 | If both rows are equal or either row can appear before the other.
1 | If row1 should appear after row2.

Remarks

When the Sort property is set to 9 (Custom Sort), the Compare event is triggered once for each pair of rows in the control that you want to compare. Because the Compare event uses row numbers instead of text values, you can use it to compare any property value for that row, including RowData. Custom sorts are always much slower that the built-in sorts. However, you can sort a row by any column or using any other cell property.


ConnectionRequest

Occurs when a remote machine requests a connection. For TCP server applications only. The event is activated when there is an incoming connection request. RemoteHostIP and RemotePort properties store the information about the client after the event is activated.

Syntax

object_ConnectionRequest ()

Remarks

Only one accepted connection will be made. Use the Listen method to accept more.


DataArrival

Occurs when new data arrives.

Syntax

object_DataArrival (long lBytes)

The parts of the DataArrival event syntax are described in the following table.

Part | Description
object | An object expression that evaluates to an object.
lBytes | Number of bytes in the input queue.


DblClick

Occurs when the user presses and releases a mouse button, then presses and releases it again over an object.

For a form, the DblClick event occurs when the user double-clicks a disabled control or a blank area of a form. For a control, it occurs when the user:

  • Double-clicks a control with the left mouse button.
  • Double-clicks an item in a ComboBox control whose Style property is set to 1 (Simple) or in a ListBox, DBCombo, or DBList control.

Syntax

Private Sub object_DblClick (index)

Part | Description
object | An object expression that evaluates to an object.
index | Identifies the control.

Remarks

You can use a DblClick event procedure for an implied action, such as double-clicking an icon to open a window or document. You can also use this type of procedure to carry out multiple steps with a single action, such as double-clicking to select an item in a list box and to close the dialog box.

To produce such shortcut effects in Visual Basic, use a DblClick event procedure for a list box or file list box in tandem with a default button — a CommandButton control with its Default property set to True. As part of the DblClick event procedure for the list box, you simply call the default button's Click event.

For those objects that receive Mouse events, the events occur in this order:

  • MouseDown, MouseUp, Click, DblClick, MouseUp

If DblClick does not occur within the system's double-click time limit, the object recognizes another Click event. The double-click time limit may vary because the user can set the double-click speed in the Control Panel. When you are attaching procedures for these related events, be sure that their actions do not conflict. Controls that do not receive DblClick events may receive two clicks instead of a DblClick.

To distinguish between the left, right, and middle mouse buttons, use the MouseDown and MouseUp events.

If there is code in the Click event, the DblClick event will never trigger.


Deactivate

  • Activate — occurs when an object becomes the active window.
  • Deactivate — occurs when an objectis no longer the active window.

Syntax

Private Sub object_Activate( )

Private Sub object_Deactivate( )

The object placeholder represents an object expression that evaluates to an object.

Remarks

An object can become active by user action, such as clicking it, or by using the Show or SetFocus methods in code.

The Activate event can occur only when an object is visible. For example, a form loaded with the Load statement is not visible unless you use the Show method or set the form's Visible property to True.

The Activate and Deactivate events occur only when moving the focus within an application. Moving the focus to or from an object in another application does not trigger either event. The Deactivate event does not occur when unloading an object.

The Activate event occurs before the GotFocus event; the LostFocus event occurs before the Deactivate event.


DropDown

Occurs when the list portion of a ComboBox control is about to drop down; this event doesn't occur if a ComboBox control's Style property is set to 1 (Simple Combo).

Syntax

Private Sub object_DropDown( )

Remarks

Use a DropDown event procedure to make final updates to a ComboBox list before the user makes a selection. This enables you to add or remove items from the list using the AddItem or RemoveItem methods. This flexibility is useful when you want some interplay between controls — for example, if what you want to load into a ComboBox list depends on what the user selects in an OptionButton group.


EnterCell

Occurs when the currently active cell changes to a different cell.

Syntax

Private Sub object_EnterCell ()

The object placeholder represents an object expression that evaluates to an object.

Remarks

Dragging the mouse over a cell does not trigger the EnterCell event.


Error

Occurs whenever an error accurs in background processing (for example, failed to connect, or failed to send or receive in the background).

Syntax

object.Error(long lNumber, BSTR bstrDescription)

The parts of the Error event syntax are described in the following table.

Part | Description
object | An object expression that evaluates to an object.
lNumber | Indicates error code from WSAGetLastError().
bstrDescription | Contains an error description.

The settings for lnumber are described in the following table.

Constant | Value | Description
sckOutOfMemory | 7 | Out of memory.
sckInvalidPropertyValue | 380 | The property value is invalid.
sckGetNotSupported | 394 | The property cannot be read.
sckSetNotSupported | 383 | The property is read-only.
sckBadState | 40006 | Wrong protocol or connection state for the requested transaction or request.
sckInvalidArg | 40014 | The argument passed to a function was not in the correct format or in the specified range.
sckSuccess | 40017 | Successful.
sckUnsupported | 40018 | Unsupported variant type.
sckInvalidOp | 40020 | Invalid operation at current state.
sckOutOfRange | 40021 | Argument is out of range.
sckWrongProtocol | 40026 | Wrong protocol for the requested transaction or request.
sckOpCanceled | 1004 | The operation was canceled.
sckInvalidArgument | 10014 | The requested address is a broadcast address, but flag is not set.
sckWouldBlock | 10035 | Socket is non-blocking and the specified operation will block.
sckInProgress | 10036 | A blocking Winsock operation in progress.
sckAlreadyComplete | 10037 | The operation is completed. No blocking operation in progress.
sckNotSocket | 10038 | The descriptor is not a socket.
sckMsgTooBig | 10040 | The datagram is too large to fit into the buffer and is truncated.
sckPortNotSupported | 10043 | The specified port is not supported.
sckAddressInUse | 10048 | Address in use.
sckAddressNotAvailable | 10049 | Address not available from the local machine.
sckNetworkSubsystemFailed | 10050 | Network subsystem failed.
sckNetworkUnreachable | 10051 | The network cannot be reached from this host at this time.
sckNetReset | 10052 | Connection has timed out when SO_KEEPALIVE is set.
sckConnectAborted | 11053 | Connection is aborted due to timeout or other failure.
sckConnectionReset | 10054 | The connection is reset by remote side.
sckNoBufferSpace | 10055 | No buffer space is available.
sckAlreadyConnected | 10056 | Socket is already connected.
sckNotConnected | 10057 | Socket is not connected.
sckSocketShutdown | 10058 | Socket has been shut down.
sckTimedout | 10060 | Socket has been shut down.
sckConnectionRefused | 10061 | Connection is forcefully rejected.
sckNotInitialized | 10093 | WinsockInit should be called first.
sckHostNotFound | 11001 | Authoritative answer: Host not found.
sckHostNotFoundTryAgain | 11002 | Non-Authoritative answer: Host not found.
sckNonRecoverableError | 11003 | Non-recoverable errors.
sckNoData | 11004 | Valid name, no data record of requested type.


Expand

The Expand event occurs when a Node object in a TreeView control is expanded, that is, when a child node becomes visible.

Syntax

Private Sub object_Expand (node[index])

The Expand event syntax has these parts:

Part | Description
object | An object expression that evaluates to an object.
node | A reference to the expanded Node object.

Remarks

The Expand event occurs after the Click and DblClick events. The Expand event is generated in three ways: when the user double-clicks a Node object that has child nodes; when the Expanded property for a Node object is set to True; and when the plus/minus image is clicked.


GotFocus

Occurs when an object receives the focus, either by user action, such as tabbing to or clicking the object, or by changing the focus in code using the SetFocus method. A form receives the focus only when all visible controls are disabled.

Syntax

Private Sub Form_GotFocus()

Remarks

Typically, you use a GotFocus event procedure to specify the actions that occur when a control or form first receives the focus. For example, by attaching a GotFocus event procedure to each control on a form, you can guide the user by displaying brief instructions or status bar messages. You can also provide visual cues by enabling, disabling, or showing other controls that depend on the control that has the focus.

Note An object can receive the focus only if its Enabled and Visible properties are set to True. To customize the keyboard interface in Visual Basic for moving the focus, set the tab order or specify access keys for controls on a form.


ItemCheck

Occurs when a ListBox control Style property is set to 1 (checkboxes) and an item's checkbox in the ListBox control is selected or cleared.

Syntax

Private Sub object_ItemCheck()

Remarks

The ItemCheck event does not occur when a list item is only highlighted; rather, it occurs when the check box of the list item is selected or cleared.

The ItemCheck event can also occur programmatically whenever an element in the Selected array of the ListBox is changed (and its Style property is set to 1.)

The ItemCheck event occurs before the Click event.


KeyDown, KeyUp

Occur when the user presses (KeyDown) or releases (KeyUp) a key while an object has the focus. (To interpret ANSI characters, use the KeyPress event.)

Syntax

Private Sub Form_KeyDown(keycode , shift )

Private Sub Form_KeyUp(keycode , shift )

The parts of the KeyDown and KeyUp event syntaxes are described in the following table.

Part | Description
object | An object expression that evaluates to an object.
keycode | A key code, such as vbKeyF1 (the F1 key) or vbKeyHome (the HOME key). To specify key codes, use the constants in the Visual Basic (VB) object library in the Object Browser.
shift | An integer that corresponds to the state of the SHIFT, CTRL, and ALT keys at the time of the event. The shift argument is a bit field with the least-significant bits corresponding to the SHIFT key (bit 0), the CTRL key (bit 1), and the ALT key (bit 2 ). These bits correspond to the values 1, 2, and 4, respectively. Some, all, or none of the bits can be set, indicating that some, all, or none of the keys are pressed. For example, if both CTRL and ALT are pressed, the value of shift is 6.

Remarks

For both events, the object with the focus receives all keystrokes. A form can have the focus only if it has no visible and enabled controls. Although the KeyDown and KeyUp events can apply to most keys, they are most often used for:

  • Extended character keys such as function keys.
  • Navigation keys.
  • Combinations of keys with standard keyboard modifiers.
  • Distinguishing between the numeric keypad and regular number keys.

Use KeyDown and KeyUp event procedures if you need to respond to both the pressing and releasing of a key.

KeyDown and KeyUp are not invoked for:

  • The ENTER key if the form has a CommandButton control with the Default property set to True.
  • The ESC key if the form has a CommandButton control with the Cancel property set to True.
  • The TAB key.

KeyDown and KeyUp interpret the uppercase and lowercase of each character by means of two arguments: keycode, which indicates the physical key (thus returning A and a as the same key) and shift, which indicates the state of shift+key and therefore returns either A or a.

If you need to test for the shift argument, you can use the shift constants which define the bits within the argument. The constants have the following values:

Constant | Value | Description
vbShiftMask | 1 | SHIFT key bit mask.
vbCtrlMask | 2 | CTRL key bit mask.
vbAltMask | 4 | ALT key bit mask.

The constants act as bit masks that you can use to test for any combination of keys.

You test for a condition by first assigning each result to a temporary integer variable and then comparing shift to a bit mask. Use the And operator with the shift argument to test whether the condition is greater than 0, indicating that the modifier was pressed, as in this example:

ShiftDown = (Shift And vbShiftMask) > 0

In a procedure, you can test for any combination of conditions, as in this example:

If ShiftDown And CtrlDown Then

If the KeyPreview property is set to True, a form receives these events before controls on the form receive the events. Use the KeyPreview property to create global keyboard-handling routines.


KeyPress

Occurs when the user presses and releases an ANSI key.

Syntax

Private Sub Form_KeyPress(keyascii )

The parts of the KeyPress event syntax are described in the following table.

Part | Description
object | An object expression that evaluates to an object.
keyascii | An integer that returns a standard numeric ANSI keycode. Keyascii is passed by reference; changing it sends a different character to the object. Changing keyascii to 0 cancels the keystroke so the object receives no character.

Remarks

The object with the focus receives the event. A form can receive the event only if it has no visible and enabled controls or if the KeyPreview property is set to True. A KeyPress event can involve any printable keyboard character, the CTRL key combined with a character from the standard alphabet or one of a few special characters, and the ENTER or BACKSPACE key. A KeyPress event procedure is useful for intercepting keystrokes entered in a TextBox or ComboBox control. It enables you to immediately test keystrokes for validity or to format characters as they are typed. Changing the value of the keyascii argument changes the character displayed.

You can convert the keyascii argument into a character by using the expression:

Chr(KeyAscii)

You can then perform string operations and translate the character back to an ANSI number that the control can interpret by using the expression:

KeyAscii = Asc(char)

Use KeyDown and KeyUp event procedures to handle any keystroke not recognized by KeyPress, such as function keys, editing keys, navigation keys, and any combinations of these with keyboard modifiers. Unlike the KeyDown and KeyUp events, KeyPress does not indicate the physical state of the keyboard; instead, it passes a character.

KeyPress interprets the uppercase and lowercase of each character as separate key codes and, therefore, as two separate characters. KeyDown and KeyUp interpret the uppercase and lowercase of each character by means of two arguments: keycode, which indicates the physical key (thus returning A and a as the same key), and shift, which indicates the state of shift+key and therefore returns either A or a.

If the KeyPreview property is set to True, a form receives the event before controls on the form receive the event. Use the KeyPreview property to create global keyboard-handling routines.

Note The ANSI number for the keyboard combination of CTRL+@ is 0. Because Visual Basic recognizes a keyascii value of 0 as a zero-length string (""), avoid using CTRL+@ in your applications.


LeaveCell

Occurs immediately before the currently active cell changes to a different cell.

Syntax

Private Sub object_LeaveCell ()

The object placeholder represents an object expression that evaluates to an object.

Remarks

This event is useful for validating a cell's contents. The LeaveCell event is not triggered when the focus moves to a different control.


Load

Occurs when a form is loaded. For a startup form, occurs when an application starts as the result of a Load statement or as the result of a reference to an unloaded form's properties or controls.

Syntax

Private Sub Form_Load( )

Remarks

Typically, you use a Load event procedure to include initialization code for a form — for example, code that specifies default settings for controls, indicates contents to be loaded into ComboBox or ListBox controls, and initializes form-level variables.

Forms are not shown until you either use the Show method or set the Visible property to True.

Note When you create procedures for related events, such as Activate, GotFocus, Paint, and Resize, be sure that their actions do not conflict and that they do not cause recursive events.


LostFocus

Occurs when an object loses the focus, either by user action, such as tabbing to or clicking another object, or by changing the focus in code using the SetFocus method.

Syntax

Private Sub object_LostFocus( )

Remarks

A LostFocus event procedure is primarily useful for verification and validation updates. Using LostFocus can cause validation to take place as the user moves the focus from the control. Another use for this type of event procedure is enabling, disabling, hiding, and displaying other objects as in a GotFocus event procedure. You can also reverse or change conditions that you set up in the object's GotFocus event procedure.


MouseDown, MouseUp

Occur when the user presses (MouseDown) or releases (MouseUp) a mouse button.

Syntax

Private Sub Form_MouseDown(button, shift, x, y)

Private Sub Form_MouseUp(button, shift, x, y)

The parts of the MouseDown and MouseUp event syntaxes are described in the following table.

Part | Description
object | Returns an object expression that evaluates to an object.
button | Returns an integer that identifies the button that was pressed (MouseDown) or released (MouseUp) to cause the event. The button argument is a bit field with bits corresponding to the left button (bit 0), right button (bit 1), and middle button (bit 2). These bits correspond to the values 1, 2, and 4, respectively. Only one of the bits is set, indicating the button that caused the event.
shift | Returns an integer that corresponds to the state of the SHIFT, CTRL, and ALT keys when the button specified in the button argument is pressed or released. A bit is set if the key is down. The shift argument is a bit field with the least-significant bits corresponding to the SHIFT key (bit 0), the CTRL key (bit 1), and the ALT key (bit 2 ). These bits correspond to the values 1, 2, and 4, respectively. The shift argument indicates the state of these keys. Some, all, or none of the bits can be set, indicating that some, all, or none of the keys are pressed. For example, if both CTRL and ALT were pressed, the value of shift would be 6.
x, y | Returns a number that specifies the current location of the mouse pointer. The x and y values are always expressed in terms of the coordinate system set by the ScaleHeight, ScaleWidth, ScaleLeft, and ScaleTop properties of the object.

Remarks

Use a MouseDown or MouseUp event procedure to specify actions that will occur when a given mouse button is pressed or released. Unlike the Click and DblClick events, MouseDown and MouseUp events enable you to distinguish between the left, right, and middle mouse buttons. You can also write code for mouse-keyboard combinations that use the SHIFT, CTRL, and ALT keyboard modifiers.

If you need to test for the button or shift arguments, you can use constants listed below:

Constant (Button) | Value | Description
vbLeftButton | 1 | Left button is pressed
vbRightButton | 2 | Right button is pressed
vbMiddleButton | 4 | Middle button is pressed

Constant (Shift) | Value | Description
vbShiftMask | 1 | SHIFT key is pressed.
vbCtrlMask | 2 | CTRL key is pressed.
vbAltMask | 4 | ALT key is pressed.

The constants then act as bit masks you can use to test for any combination of buttons without having to figure out the unique bit field value for each combination.

You can use a MouseMove event procedure to respond to an event caused by moving the mouse. The button argument for MouseDown and MouseUp differs from the button argument used for MouseMove. For MouseDown and MouseUp, the button argument indicates exactly one button per event, whereas for MouseMove, it indicates the current state of all buttons.


MouseMove

Occurs when the user moves the mouse.

Syntax

Private Sub Form_MouseMove(button, shift, x, y)

The parts of the MouseMove event syntax are described in the following table.

Part | Description
object | An object expression that evaluates to an object.
button | An integer that corresponds to the state of the mouse buttons in which a bit is set if the button is down. The button argument is a bit field with bits corresponding to the left button (bit 0), right button (bit 1), and middle button (bit 2). These bits correspond to the values 1, 2, and 4, respectively. It indicates the complete state of the mouse buttons; some, all, or none of these three bits can be set, indicating that some, all, or none of the buttons are pressed.
shift | An integer that corresponds to the state of the SHIFT, CTRL, and ALT keys. A bit is set if the key is down. The shift argument is a bit field with the least-significant bits corresponding to the SHIFT key (bit 0), the CTRL key (bit 1), and the ALT key (bit 2 ). These bits correspond to the values 1, 2, and 4, respectively. The shift argument indicates the state of these keys. Some, all, or none of the bits can be set, indicating that some, all, or none of the keys are pressed. For example, if both CTRL and ALT were pressed, the value of shift would be 6.
x, y | A number that specifies the current location of the mouse pointer. The x and y values are always expressed in terms of the coordinate system set by the ScaleHeight, ScaleWidth, ScaleLeft, and ScaleTop properties of the object.

Remarks

The MouseMove event is generated continually as the mouse pointer moves across objects. Unless another object has captured the mouse, an object recognizes a MouseMove event whenever the mouse position is within its borders.

If you need to test for the button or shift arguments, you can use constants listed elow:

Constant (Button) | Value | Description
vbLeftButton | 1 | Left button is pressed.
vbRightButton | 2 | Right button is pressed.
vbMiddleButton | 4 | Middle button is pressed.

Constant (Shift) | Value | Description
vbShiftMask | 1 | SHIFT key is pressed.
vbCtrlMask | 2 | CTRL key is pressed.
vbAltMask | 4 | ALT key is pressed.

The constants then act as bit masks you can use to test for any combination of buttons without having to figure out the unique bit field value for each combination.

You test for a condition by first assigning each result to a temporary integer variable and then comparing the button or shift arguments to a bit mask. Use the And operator with each argument to test if the condition is greater than zero, indicating the key or button is pressed, as in this example:

LeftDown = (Button And vbLeftButton) > 0

CtrlDown = (Shift And vbCtrlMask) > 0

Then, in a procedure, you can test for any combination of conditions, as in this example:

If LeftDown And CtrlDown Then

Note You can use MouseDown and MouseUp event procedures to respond to events caused by pressing and releasing mouse buttons.

The button argument for MouseMove differs from the button argument for MouseDown and MouseUp. For MouseMove, the button argument indicates the current state of all buttons; a single MouseMove event can indicate that some, all, or no buttons are pressed. For MouseDown and MouseUp, the button argument indicates exactly one button per event.

Any time you move a window inside a MouseMove event, it can cause a cascading event. MouseMove events are generated when the window moves underneath the pointer. A MouseMove event can be generated even if the mouse is perfectly stationary.


NodeClick

The NodeClick event occurs when a Node object in a TreeView control is clicked.

Syntax

Private Sub object_NodeClick (node[index])

The NodeClick event syntax has these parts:

Part | Description
object | An object expression that evaluates to an object.
node | A reference to the clicked Node object.

Remarks

The standard Click event is generated when the user clicks any part of the TreeView control outside a node object. The NodeClick event is generated when the user clicks a particular Node object; the NodeClick event also returns a reference to a particular Node object which can be used to validate the Node before further action is taken. The NodeClick event occurs before the standard Click event.


OnComm

The OnComm event is generated whenever the value of the CommEvent property changes, indicating that either a communication event or an error occurred.

Syntax

Private Sub object_OnComm ()

The OnComm event syntax has these parts:

Part | Description
object | An object expression that evaluates to an object.

Remarks

The CommEvent property contains the numeric code of the actual error or event that generated the OnComm event. Note that setting the RThreshold or SThreshold properties to 0 disables trapping for the comEvReceive and comEvSend events, respectively.


Paint

Occurs when part or all of an object is exposed after being moved or enlarged, or after a window that was covering the object has been moved.

Syntax

Private Sub Form_Paint( )

The Paint event syntax has these parts:

Part | Description
object | An object expression that evaluates to an object.

Remarks

A Paint event procedure is useful if you have output from graphics methods in your code. With a Paint procedure, you can ensure that such output is repainted when necessary.

The Paint event is invoked when the Refresh method is used.

If the ClipControls property is set to False, graphics methods in the Paint event procedure affect only newly exposed areas of the form; otherwise, the graphics methods repaint all areas of the form not covered by controls (except Label, Line, and Shape controls).

Note Using a Refresh method in a Resize event procedure forces repainting of the entire object every time a user resizes the form.

Using a Paint event procedure for certain tasks can cause a cascading event. In general, avoid using a Paint event procedure to do the following:

  • Move or size a form or control.
  • Change any variables that affect size or appearance, such as setting an object's BackColor property.
  • Invoke a Refresh method.

A Resize event procedure may be more appropriate for some of these tasks.


QueryUnload

Occurs before a form or application closes.

Syntax

Private Sub Form_QueryUnload(cancel, unloadmode)

The QueryUnload event syntax has these parts:

Part | Description
cancel | An integer. Setting this argument to any value other than 0 stops the QueryUnload event in all loaded forms and stops the form and application from closing.
unloadmode | A value or constant indicating the cause of the QueryUnload event, as described in Return Values.

Return Values

The unloadmode argument returns the following values:

Constant | Value | Description
vbFormControlMenu | 0 | The user chose the Close command from the Control menu on the form.
vbFormCode | 1 | The Unload statement is invoked from code.
vbAppWindows | 2 | The current Microsoft Windows operating environment session is ending.
vbAppTaskManager | 3 | The Microsoft Windows Task Manager is closing the application.

Remarks

This event is typically used to make sure there are no unfinished tasks in the forms included in an application before that application closes. For example, if a user has not yet saved some new data in any form, your application can prompt the user to save the data.

When an application closes, you can use either the QueryUnload or Unload event procedure to set the Cancel property to True, stopping the closing process. However, the QueryUnload event occurs in all forms before any are unloaded, and the Unload event occurs as each form is unloaded.


Resize

Occurs when an object is first displayed or when the window state of an object changes. (For example, a form is maximized, minimized, or restored.)

Syntax

Private Sub Form_Resize()

Private Sub object_Resize(height, width)

The Resize event syntax has these parts:

Part | Description
object | An object expression that evaluates to an object.
height | Number specifying the new height of the control.
width | Number specifying the new width of the control.

Remarks

Use a Resize event procedure to move or resize controls when the parent form is resized. You can also use this event procedure to recalculate variables or properties, such as ScaleHeight and ScaleWidth, that may depend on the size of the form. If you want graphics to maintain sizes proportional to the form when it's resized, invoke the Paint event by using the Refresh method in a Resize event procedure.

Whenever the AutoRedraw property is set to False and the form is resized, Visual Basic also calls the related events, Resize and Paint, in that order. When you attach procedures for these related events, be sure their actions do not conflict.


RowColChange

Occurs when the currently active cell changes to a different cell.

Syntax

Private Sub object_RowColChange ()

The object placeholder represents an object expression that evaluates to an object.

Remarks

The order of events triggered when the active cell changes is: LeaveCell, EnterCell, RowColChange.

The RowColChange event occurs when a user clicks a new cell, but not while a user drags the selection across the Grid control.


Scroll

Occurs when the scroll box on a ScrollBar control, or an object which contains a scrollbar, is repositioned or scrolled horizontally or vertically.

Syntax

Private Sub object_Scroll( )

The parts of the Scroll event syntax are described in the following table.

Part | Description
object | An object expression that evaluates to an object.

Remarks

For a ComboBox control, this event occurs only when the scrollbars in the dropdown portion of the control are manipulated.

You can use this event to perform calculations or to manipulate controls that must be coordinated with ongoing changes in scroll bars. In contrast, use the Change event when you want an update to occur only once, after a ScrollBar control changes.

Note Avoid using a MsgBox statement or function in this event.


Scroll (Grid)

Occurs when the Grid scrolls its contents, either through the scroll bars, keyboard, or code changing the TopRow or LeftCol properties.

Syntax

Private Sub object_Scroll ()

The object placeholder represents an object expression that evaluates to an object.

Remarks

If the ScrollTrack property is set to True, the scroll event is triggered while the user is dragging/scrolling the mouse; otherwise, it is not triggered until the drag is complete.


SendComplete

Occurs when a Send operation is completed.

Syntax

object.SendComplete()


SelChange

Occurs when the selected range changes to a different cell or range of cells.

Syntax

Private Sub object_SelChange ()

The object placeholder represents an object expression that evaluates to an object.

Remarks

The SelChange event occurs whenever the user clicks a cell other than the selected cell and as a user drags to select a new range of cells. A user can also select a range of cells by pressing the SHIFT key and using the arrow keys.

This event can be triggered in code by changing the selected region using the Row, Col, RowSel, or ColSel properties. The RowColChange event also occurs when a user clicks a new cell but does not occur while a user drags the selection across Grid.


SendProgress

Occurs while data is being sent.

Syntax

object.SendProgress(long lBytesSent, long lBytesRemaining)

The parts of the SendProgress event syntax are described in the following table.

Part | Description
object | An object expression that evaluates to an object.
lbytesSent | Total number of bytes to be sent.
lbytesRemaining | Indicates number of bytes yet to be sent.


Terminate

Occurs when all references to an instance of a Form are removed from memory by setting all the variables that refer to the object to Nothing or when the last reference to the object falls out of scope.

Syntax

Private Sub object_Terminate( )

Remarks

For all objects, the Terminate event occurs after the Unload event.

The Terminate event is not triggered if the instances of the form were removed from memory because the application terminated abnormally.


Timer

Occurs when a preset interval for a Timer control has elapsed. The interval's frequency is stored in the control's Interval property, which specifies the length of time in milliseconds.

Syntax

Private Sub object_Timer()

Remarks

Use this event procedure to tell Visual Basic what to do after each Timer control interval has elapsed. When you are working with the Timer event:

  • The Interval property specifies the interval between Timer events in milliseconds.
  • Whenever the Timer control's Enabled property is set to True and the Interval property is greater than 0, the Timer event waits for the period specified in the Interval property.


Unload

Occurs when a form is about to be removed from the screen.

Syntax

Private Sub Form_Unload(cancel)

The Unload event syntax has these parts:

Part | Description
object | An object expression that evaluates to an object.
cancel | An integer. Setting this argument to any value other than 0 stops the Unload event in all loaded forms and stops the form and application from closing.

Remarks

Use an Unload event procedure to verify that the form should be unloaded or to specify actions that you want to take place when the form is unloaded. You can also include any form-level validation code you may need for closing the form or saving the data in it to a file.

When an application closes, you can use either the QueryUnload or Unload event procedure to set the Cancel property to True, stopping the closing process. However, the QueryUnload event occurs in all forms before any are unloaded, and the Unload event occurs as each form is unloaded.


Functions

Functions

Abs

Array

Asc

Atn

CBool

CByte

CCur

CDate

CDbl

Chr

CInt

CLng

Cos

CreateObject

CSng

CStr

Date

DateAdd

DateDiff

DatePart

DateSerial

DateValue

Day

Exp

Filter

FormatCurrency

FormatDateTime

FormatNumber

FormatPercent

Hex

Hour

InputBox

InStr

InStrRev

Int, Fix

IsArray

IsDate

IsEmpty

IsNull

IsNumeric

IsObject

Join

LBound

LCase

Left

Len

Log

LTrim, Rtrim, Trim

Mid

Minute

Month

MonthName

MsgBox

Now

Oct

Replace

Right

Rnd

Round

ScriptEngine

ScriptEngineBuildVersion

ScriptEngineMajorVersion

ScriptEngineMinorVersion

Second

Sgn

Sin

Space

Split

Sqr

StrComp

StrReverse

String

Tan

Time

TimeSerial

TimeValue

TypeName

UBound

UCase

VarType

Weekday

WeekdayName

Year


Abs

Returns the absolute value of a number.

Syntax

Abs(number)

The number argument can be any valid numeric expression . If number contains Null, Null is returned; if it is an uninitialized variable, zero is returned.

Remarks

The absolute value of a number is its unsigned magnitude. For example, Abs(-1) and Abs(1) both return 1.


Array

Returns a Variant containing an array.

Syntax

Array(arglist)

The required arglist argument is a comma-delimited list of values that are assigned to the elements of an array contained with the Variant. If no arguments are specified, an array of zero length is created.

Remarks

The notation used to refer to an element of an array consists of the variable name followed by parentheses containing an index number indicating the desired element. In the following example, the first statement creates a variable named A. The second statement assigns an array to variable A. The last statement assigns the value contained in the second array element to another variable.

Dim A
A = Array(10,20,20)
B = A(2)

Note A variable that is not declared as an array can still contain an array. Although a Variant variable containing an array is conceptually different from an array variable containing Variant elements, the array elements are accessed in the same way.


Asc

Returns the ANSI character code corresponding to the first letter in a string.

Syntax

Asc(string)

The string argument is any valid string expression. If the string contains no characters, a run-time error occurs.

Note The AscBis used with byte data contained in a string. Instead of returning the character code for the first character, AscB returns the first byte. AscW is provided for 32-bit platforms that use Unicode characters. It returns the Unicode (wide) character code, thereby avoiding the conversion from Unicode to ANSI.


Atn

Returns the arctangent of a number.

Syntax

Atn(number)

The number argument can be any valid numeric expression.

Remarks

The Atntakes the ratio of two sides of a right triangle (number) and returns the corresponding angle in radians. The ratio is the length of the side opposite the angle divided by the length of the side adjacent to the angle.

The range of the result is -pi/2 to pi/2 radians.

To convert degrees to radians, multiply degrees by pi/180. To convert radians to degrees, multiply radians by 180/pi.

Note Atn is the inverse trigonometricof Tan, which takes an angle as its argument and returns the ratio of two sides of a right triangle. Do not confuse Atn with the cotangent, which is the simple inverse of a tangent (1/tangent).


CBool

Returns an expression that has been converted to a Variant of subtype Boolean.

Syntax

CBool(expression)

The expression argument is any valid expression.

Remarks

If expression is zero, False is returned; otherwise, True is returned. If expression can't be interpreted as a numeric value, a run-time error occurs.


CByte

Returns an expression that has been converted to a Variant of subtype Byte.

Syntax

CByte(expression)

The expression argument is any valid expression.

Remarks

In general, you can document your code using the subtype conversion functions to show that the result of some operation should be expressed as a particular data type rather than the default data type. For example, use CByte to force byte arithmetic in cases where currency, single-precision, double-precision, or integer arithmetic normally would occur.

Use the CByteto provide internationally aware conversions from any other data type to a Byte subtype. For example, different decimal separators are properly recognized depending on the locale setting of your system, as are different thousand separators.

If expression lies outside the acceptable range for the Byte subtype, an error occurs.


CCur

Returns an expression that has been converted to a Variant of subtype Currency.

Syntax

CCur(expression)

The expression argument is any valid expression.

Remarks

In general, you can document your code using the subtype conversion functions to show that the result of some operation should be expressed as a particular data type rather than the default data type. For example, use CCur to force currency arithmetic in cases where integer arithmetic normally would occur.

You should use the CCurto provide internationally aware conversions from any other data type to a Currency subtype. For example, different decimal separators and thousands separators are properly recognized depending on the locale setting of your system.


CDate

Returns an expression that has been converted to a Variant of subtype Date.

Syntax

CDate(date)

The date argument is any valid date expression.

Remarks

Use the IsDateto determine if date can be converted to a date or time. CDate recognizes date literals and time literals as well as some numbers that fall within the range of acceptable dates. When converting a number to a date, the whole number portion is converted to a date. Any fractional part of the number is converted to a time of day, starting at midnight.

CDate recognizes date formats according to the locale setting of your system. The correct order of day, month, and year may not be determined if it is provided in a format other than one of the recognized date settings. In addition, a long date format is not recognized if it also contains the day-of-the-week string.


CDbl

Returns an expression that has been converted to a Variant of subtype Double.

Syntax

CDbl(expression)

The expression argument is any valid expression.

Remarks

In general, you can document your code using the subtype conversion functions to show that the result of some operation should be expressed as a particular data type rather than the default data type. For example, use CDbl or CSng to force double-precision or single-precision arithmetic in cases where currency or integer arithmetic normally would occur.

Use the CDblto provide internationally aware conversions from any other data type to a Double subtype. For example, different decimal separators and thousands separators are properly recognized depending on the locale setting of your system.


Chr

Returns the character associated with the specified ANSI character code.

Syntax

Chr(charcode)

The charcode argument is a number that identifies a character.

Remarks

Numbers from 0 to 31 are the same as standard, nonprintable ASCII codes. For example, Chr(10) returns a linefeed character.

Note The ChrBis used with byte data contained in a string. Instead of returning a character, which may be one or two bytes, ChrB always returns a single byte. ChrW is provided for 32-bit platforms that use Unicode characters. Its argument is a Unicode (wide) character code, thereby avoiding the conversion from ANSI to Unicode.


CInt

Returns an expression that has been converted to a Variant of subtype Integer.

Syntax

CInt(expression)

The expression argument is any valid expression.

Remarks

In general, you can document your code using the subtype conversion functions to show that the result of some operation should be expressed as a particular data type rather than the default data type. For example, use CInt or CLng to force integer arithmetic in cases where currency, single-precision, or double-precision arithmetic normally would occur.

Use the CIntto provide internationally aware conversions from any other data type to an Integer subtype. For example, different decimal separators are properly recognized depending on the locale setting of your system, as are different thousand separators.

If expression lies outside the acceptable range for the Integer subtype, an error occurs.

Note CInt differs from the Fix and Int functions, which truncate, rather than round, the fractional part of a number. When the fractional part is exactly 0.5, the CIntalways rounds it to the nearest even number. For example, 0.5 rounds to 0, and 1.5 rounds to 2.


CLng

Returns an expression that has been converted to a Variant of subtype Long.

Syntax

CLng(expression)

The expression argument is any valid expression.

Remarks

In general, you can document your code using the subtype conversion functions to show that the result of some operation should be expressed as a particular data type rather than the default data type. For example, use CInt or CLng to force integer arithmetic in cases where currency, single-precision, or double-precision arithmetic normally would occur.

Use the CLngto provide internationally aware conversions from any other data type to a Long subtype. For example, different decimal separators are properly recognized depending on the locale setting of your system, as are different thousand separators.

If expression lies outside the acceptable range for the Long subtype, an error occurs.

Note CLng differs from the Fix and Int functions, which truncate, rather than round, the fractional part of a number. When the fractional part is exactly 0.5, the CLngalways rounds it to the nearest even number. For example, 0.5 rounds to 0, and 1.5 rounds to 2.


Cos

Returns the cosine of an angle.

Syntax

Cos(number)

The number argument can be any valid numeric expression that expresses an angle in radians.

Remarks

The Costakes an angle and returns the ratio of two sides of a right triangle. The ratio is the length of the side adjacent to the angle divided by the length of the hypotenuse.

The result lies in the range -1 to 1.

To convert degrees to radians, multiply degrees by pi/180. To convert radians to degrees, multiply radians by 180/pi.


CreateObject

Creates and returns a reference to an Automation object.

Syntax

CreateObject(class)

The class argument uses the syntax servername.typename and has these parts:

Part | Description
servername | The name of the application providing the object.
typename | The type or class of the object to create.

Remarks

Automation servers provide at least one type of object. For example, a word-processing application may provide an application object, a document object, and a toolbar object.


CSng

Returns an expression that has been converted to a Variant of subtype Single.

Syntax

CSng(expression)

The expression argument is any valid expression.

Remarks

In general, you can document your code using the data type conversion functions to show that the result of some operation should be expressed as a particular data type rather than the default data type. For example, use CDbl or CSng to force double-precision or single-precision arithmetic in cases where currency or integer arithmetic normally would occur.

Use the CSngto provide internationally aware conversions from any other data type to a Single subtype. For example, different decimal separators are properly recognized depending on the locale setting of your system, as are different thousand separators.

If expression lies outside the acceptable range for the Single subtype, an error occurs.


CStr

Returns an expression that has been converted to a Variant of subtype String.

Syntax

CStr(expression)

The expression argument is any valid expression.

Remarks

In general, you can document your code using the data type conversion functions to show that the result of some operation should be expressed as a particular data type rather than the default data type. For example, use CStr to force the result to be expressed as a String.

You should use the CStrinstead of Str to provide internationally aware conversions from any other data type to a String subtype. For example, different decimal separators are properly recognized depending on the locale setting of your system.

The data in expression determines what is returned according to the following table:

If expression is | CStr returns
boolean | A String containing True or False.
date | A String containing a date in the short-date format of your system.
null | A run-time error.
empty | A zero-length String ("").
error | A String containing the word Error followed by the error number.
other numeric | A String containing the number.


Date

Returns the current system date.

Syntax

Date


DateAdd

Returns a date to which a specified time interval has been added.

Syntax

DateAdd(interval, number, date)

The DataAdd syntax has these parts:

Part | Description
interval | Required. String expression that is the interval you want to add. See Settings section for values.
number | Required. Numeric expression that is the number of interval you want to add. The numeric expression can either be positive, for dates in the future, or negative, for dates in the past.
date | Required. Variant or literal representing the date to which interval is added.

Settings

The interval argument can have the following values:

Setting | Description
yyyy | Year
q | Quarter
m | Month
y | Day of year
d | Day
w | Weekday
ww | Week of year
h | Hour
m | Minute
s | Second

Remarks

You can use the DateAddto add or subtract a specified time interval from a date. For example, you can use DateAdd to calculate a date 30 days from today or a time 45 minutes from now. To add days to date, you can use Day of Year ("y"), Day ("d"), or Weekday ("w").

The DateAddwon't return an invalid date. The following example adds one month to January 31:

NewDate = DateAdd("m", 1, "31-Jan-95")

In this case, DateAdd returns 28-Feb-95, not 31-Feb-95. If date is 31-Jan-96, it returns 29-Feb-96 because 1996 is a leap year.

If the calculated date would precede the year 100, an error occurs.

If number isn't a Long value, it is rounded to the nearest whole number before being evaluated.


DateDiff

Returns the number of intervals between two dates.

Syntax

DateDiff(interval, date1, date2 [,firstdayofweek[, firstweekofyear]])

The DateDiff syntax has these parts:

Part | Description
interval | Required. String expression that is the interval you want to use to calculate the differences between date1 and date2. See Settings section for values.
date1, date2 | Required. Date expressions. Two dates you want to use in the calculation.
firstdayofweek | Optional. Constant that specifies the day of the week. If not specified, Sunday is assumed. See Settings section for values.
firstweekofyear | Optional. Constant that specifies the first week of the year. If not specified, the first week is assumed to be the week in which January 1 occurs. See Settings section for values.

Settings

The interval argument can have the following values:

Setting | Description
yyyy | Year
q | Quarter
m | Month
y | Day of year
d | Day
w | Weekday
ww | Week of year
h | Hour
m | Minute
s | Second

The firstdayofweek argument can have the following values:

Constant | Value | Description
vbUseSystem | 0 | Use National Language Support (NLS) API setting.
vbSunday | 1 | Sunday (default)
vbMonday | 2 | Monday
vbTuesday | 3 | Tuesday
vbWednesday | 4 | Wednesday
vbThursday | 5 | Thursday
vbFriday | 6 | Friday
vbSaturday | 7 | Saturday

The firstweekofyear argument can have the following values:

Constant | Value | Description
vbUseSystem | 0 | Use National Language Support (NLS) API setting.
vbFirstJan1 | 1 | Start with the week in which January 1 occurs (default).
vbFirstFourDays | 2 | Start with the week that has at least four days in the new year.
vbFirstFullWeek | 3 | Start with the first full weekof the new year.

Remarks

You can use the DateDiff to determine how many specified time intervals exist between two dates. For example, you might use DateDiff to calculate the number of days between two dates, or the number of weeks between today and the end of the year.

To calculate the number of days between date1 and date2, you can use either Day of year ("y") or Day ("d"). When interval is Weekday ("w"), DateDiff returns the number of weeks between the two dates. If date1 falls on a Monday, DateDiff counts the number of Mondays until date2. It counts date2 but not date1. If interval is Week ("ww"), however, the DateDiff returns the number of calendar weeks between the two dates. It counts the number of Sundays between date1 and date2. DateDiff counts date2 if it falls on a Sunday; but it doesn't count date1, even if it does fall on a Sunday.

If date1 refers to a later point in time than date2, the DateDiff returns a negative number.

The firstdayofweek argument affects calculations that use the "w" and "ww" interval symbols.

If date1 or date2 is a date literal, the specified year becomes a permanent part of that date. However, if date1 or date2 is enclosed in quotation marks (" ") and you omit the year, the current year is inserted in your code each time the date1 or date2 expression is evaluated. This makes it possible to write code that can be used in different years.

When comparing December 31 to January 1 of the immediately succeeding year, DateDiff for Year ("yyyy") returns 1 even though only a day has elapsed.


DatePart

Returns the specified part of a given date.

Syntax

DatePart(interval, date[, firstdayofweek[, firstweekofyear]])

The DatePart syntax has these parts:

Part | Description
interval | Required. String expression that is the interval of time you want to return. See Settings section for values.
date | Required. Date expression you want to evaluate.
firstdayof week | Optional. Constant that specifies the day of the week. If not specified, Sunday is assumed. See Settings section for values.
firstweekofyear | Optional. Constant that specifies the first week of the year. If not specified, the first week is assumed to be the week in which January 1 occurs. See Settings section for values.

Settings

The interval argument can have the following values:

Setting | Description
yyyy | Year
q | Quarter
m | Month
y | Day of year
d | Day
w | Weekday
ww | Week of year
h | Hour
m | Minute
s | Second

The firstdayofweek argument can have the following values:

Constant | Value | Description
vbUseSystem | 0 | Use National Language Support (NLS) API setting.
vbSunday | 1 | Sunday (default)
vbMonday | 2 | Monday
vbTuesday | 3 | Tuesday
vbWednesday | 4 | Wednesday
vbThursday | 5 | Thursday
vbFriday | 6 | Friday
vbSaturday | 7 | Saturday

The firstweekofyear argument can have the following values:

Constant | Value | Description
vbUseSystem | 0 | Use National Language Support (NLS) API setting.
vbFirstJan1 | 1 | Start with the week in which January 1 occurs (default).
vbFirstFourDays | 2 | Start with the week that has at least four days in the new year.
vbFirstFullWeek | 3 | Start with the first full weekof the new year.

Remarks

You can use the DatePart to evaluate a date and return a specific interval of time. For example, you might use DatePart to calculate the day of the week or the current hour.

The firstdayofweek argument affects calculations that use the "w" and "ww" interval symbols.

If date is a date literal, the specified year becomes a permanent part of that date. However, if date is enclosed in quotation marks (" "), and you omit the year, the current year is inserted in your code each time the date expression is evaluated. This makes it possible to write code that can be used in different years.


DateSerial

Returns a Variant of subtype Date for a specified year, month, and day.

Syntax

DateSerial(year, month, day)

The DateSerial syntax has these arguments:

Part | Description
year | Number between 100 and 9999, inclusive, or a numeric expression.
month | Any numeric expression.
day | Any numeric expression.

Remarks

To specify a date, such as December 31, 1991, the range of numbers for each DateSerial argument should be in the accepted range for the unit; that is, 1–31 for days and 1–12 for months. However, you can also specify relative dates for each argument using any numeric expression that represents some number of days, months, or years before or after a certain date.

The following example uses numeric expressions instead of absolute date numbers. Here the DateSerial returns a date that is the day before the first day (1 – 1) of two months before August (8 – 2) of 10 years before 1990 (1990 – 10); in other words, May 31, 1980.

DateSerial(1990 - 10, 8 - 2, 1 - 1)

For the year argument, values between 0 and 99, inclusive, are interpreted as the years 1900–1999. For all other year arguments, use a complete four-digit year (for example, 1800).

When any argument exceeds the accepted range for that argument, it increments to the next larger unit as appropriate. For example, if you specify 35 days, it is evaluated as one month and some number of days, depending on where in the year it is applied. However, if any single argument is outside the range -32,768 to 32,767, or if the date specified by the three arguments, either directly or by expression, falls outside the acceptable range of dates, an error occurs.


DateValue

Returns a Variant of subtype Date.

Syntax

DateValue(date)

The date argument is normally a string expression representing a date from January 1, 100 through December 31, 9999. However, date can also be any expression that can represent a date, a time, or both a date and time, in that range.

Remarks

If the date argument includes time information, DateValue doesn't return it. However, if date includes invalid time information (such as "89:98"), an error occurs.

If date is a string that includes only numbers separated by valid date separators, DateValue recognizes the order for month, day, and year according to the short date format you specified for your system. DateValue also recognizes unambiguous dates that contain month names, either in long or abbreviated form. For example, in addition to recognizing 12/30/1991 and 12/30/91, DateValue also recognizes December 30, 1991 and Dec 30, 1991.

If the year part of date is omitted, DateValue uses the current year from your computer's system date.


Day

Description

Returns a whole number between 1 and 31, inclusive, representing the day of the month.

Syntax

Day(date)

The date argument is any expression that can represent a date. If date contains Null, Null is returned.


Exp

Returns e (the base of natural logarithms) raised to a power.

Syntax

Exp(number)

The number argument can be any valid numeric expression.

Remarks

If the value of number exceeds 709.782712893, an error occurs. The constant e is approximately 2.718282.

Note The Exp complements the action of the Log and is sometimes referred to as the antilogarithm.


Filter

Returns a zero-based array containing subset of a string array based on a specified filter criteria.

Syntax

Filter(InputStrings, Value[, Include[, Compare]])

The Filter syntax has these parts:

Part | Description
InputStrings | Required. One-dimensional array of strings to be searched.
Value | Required. String to search for.
Include | Optional. Boolean value indicating whether to return substrings that include or exclude Value. If Include is True, Filter returns the subset of the array that contains Value as a substring. If Include is False, Filter returns the subset of the array that does not contain Value as a substring.
Compare | Optional. Numeric value indicating the kind of string comparison to use. See Settings section for values.

Settings

The Compare argument can have the following values:

Constant | Value | Description
vbBinaryCompare | 0 | Perform a binary comparison.
vbTextCompare | 1 | Perform a textual comparison.
vbDatabaseCompare | 2 | Perform a comparison based on information contained in the database where the comparison is to be performed.

Remarks

If no matches of Value are found within InputStrings, Filter returns an empty array. An error occurs if InputStrings is Null or is not a one-dimensional array.

The array returned by the Filtercontains only enough elements to contain the number of matched items.


FormatCurrency

Returns an expression formatted as a currency value using the currency symbol defined in the system control panel.

Syntax

FormatCurrency(Expression[,NumDigitsAfterDecimal [,IncludeLeadingDigit [,UseParensForNegativeNumbers [,GroupDigits]]]])

The FormatCurrency syntax has these parts:

Part | Description
Expression | Required. Expression to be formatted.
NumDigitsAfterDecimal | Optional. Numeric value indicating how many places to the right of the decimal are displayed. Default value is -1, which indicates that the computer's regional settings are used.
IncludeLeadingDigit | Optional. Tristate constant that indicates whether or not a leading zero is displayed for fractional values. See Settings section for values.
UseParensForNegativeNumbers | Optional. Tristate constant that indicates whether or not to place negative values within parentheses. See Settings section for values.
GroupDigits | Optional. Tristate constant that indicates whether or not numbers are grouped using the group delimiter specified in the computer's regional settings. See Settings section for values.

Settings

The IncludeLeadingDigit, UseParensForNegativeNumbers, and GroupDigits arguments have the following settings:

Constant | Value | Description
TristateTrue | -1 | True
TristateFalse | 0 | False
TristateUseDefault | -2 | Use the setting from the computer's regional settings.

Remarks

When one or more optional arguments are omitted, values for omitted arguments are provided by the computer's regional settings.

The position of the currency symbol relative to the currency value is determined by the system's regional settings.

Note All settings information comes from the Regional Settings Currency tab, except leading zero which comes from the Number tab.


FormatDateTime

Returns an expression formatted as a date or time.

Syntax

FormatDateTime(Date[,NamedFormat])

The FormatDateTimes yntax has these parts:

Part | Description
Date | Required. Date expression to be formatted.
NamedFormat | Optional. Numeric value that indicates the date/time format used. If omitted, vbGeneralDate is used.

Settings

The NamedFormat argument has the following settings:

Constant | Value | Description
vbGeneralDate | 0 | Display a date and/or time. If there is a date part, display it as a short date. If there is a time part, display it as a long time. If present, both parts are displayed.
vbLongDate | 1 | Display a date using the long date format specified in your computer's regional settings.
vbShortDate | 2 | Display a date using the short date format specified in your computer's regional settings.
vbLongTime | 3 | Display a time using the time format specified in your computer's regional settings.
vbShortTime | 4 | Display a time using the 24-hour format (hh:mm).


FormatNumber

Description

Returns an expression formatted as a number.

Syntax

FormatNumber(Expression[,NumDigitsAfterDecimal [,IncludeLeadingDigit [,UseParensForNegativeNumbers [,GroupDigits]]]])

The FormatNumber syntax has these parts:

Part | Description
Expression | Required. Expression to be formatted.
NumDigitsAfterDecimal | Optional. Numeric value indicating how many places to the right of the decimal are displayed. Default value is -1, which indicates that the computer's regional settings are used.
IncludeLeadingDigit | Optional. Tristate constant that indicates whether or not a leading zero is displayed for fractional values. See Settings section for values.
UseParensForNegativeNumbers | Optional. Tristate constant that indicates whether or not to place negative values within parentheses. See Settings section for values.
GroupDigits | Optional. Tristate constant that indicates whether or not numbers are grouped using the group delimiter specified in the control panel. See Settings section for values.

Settings

The IncludeLeadingDigit, UseParensForNegativeNumbers, and GroupDigits arguments have the following settings:

Constant | Value | Description
TristateTrue | -1 | True
TristateFalse | 0 | False
TristateUseDefault | -2 | Use the setting from the computer's regional settings.

Remarks

When one or more of the optional arguments are omitted, the values for omitted arguments are provided by the computer's regional settings.

Note All settings information comes from the Regional Settings Number tab.


FormatPercent

Returns an expression formatted as a percentage (multiplied by 100) with a trailing % character.

Syntax

FormatPercent(Expression[,NumDigitsAfterDecimal [,IncludeLeadingDigit [,UseParensForNegativeNumbers [,GroupDigits]]]])

The FormatPercent syntax has these parts:

Part | Description
Expression | Required. Expression to be formatted.
NumDigitsAfterDecimal | Optional. Numeric value indicating how many places to the right of the decimal are displayed. Default value is -1, which indicates that the computer's regional settings are used.
IncludeLeadingDigit | Optional. Tristate constant that indicates whether or not a leading zero is displayed for fractional values. See Settings section for values.
UseParensForNegativeNumbers | Optional. Tristate constant that indicates whether or not to place negative values within parentheses. See Settings section for values.
GroupDigits | Optional. Tristate constant that indicates whether or not numbers are grouped using the group delimiter specified in the control panel. See Settings section for values.

Settings

The IncludeLeadingDigit, UseParensForNegativeNumbers, and GroupDigits arguments have the following settings:

Constant | Value | Description
TristateTrue | -1 | True
TristateFalse | 0 | False
TristateUseDefault | -2 | Use the setting from the computer's regional settings.

Remarks

When one or more optional arguments are omitted, the values for the omitted arguments are provided by the computer's regional settings.

Note All settings information comes from the Regional Settings Number tab.


Hex

Returns a string representing the hexadecimal value of a number.

Syntax

Hex(number)

The number argument is any valid expression.

Remarks

If number is not already a whole number, it is rounded to the nearest whole number before being evaluated.

If number is | Hex returns
Null | Null.
Empty | Zero (0).
Any other number | Up to eight hexadecimal characters.

You can represent hexadecimal numbers directly by preceding numbers in the proper range with &H. For example, &H10 represents decimal 16 in hexadecimal notation.


Hour

Description

Returns a whole number between 0 and 23, inclusive, representing the hour of the day.

Syntax

Hour(time)

The time argument is any expression that can represent a time. If time contains Null, Null is returned.


InputBox

Description

Displays a prompt in a dialog box, waits for the user to input text or click a button, and returns the contents of the text box.

Syntax

InputBox(prompt[, title][, default][, xpos][, ypos][, helpfile, context])

The InputBox syntax has these arguments:

Part | Description
prompt | String expression displayed as the message in the dialog box. The maximum length of prompt is approximately 1024 characters, depending on the width of the characters used. If prompt consists of more than one line, you can separate the lines using a carriage return character (Chr(13)), a linefeed character (Chr(10)), or carriage return–linefeed character combination (Chr(13) & Chr(10)) between each line.
title | String expression displayed in the title bar of the dialog box. If you omit title, the application name is placed in the title bar.
default | String expression displayed in the text box as the default response if no other input is provided. If you omit default, the text box is displayed empty.
xpos | Numeric expression that specifies, in twips, the horizontal distance of the left edge of the dialog box from the left edge of the screen. If xpos is omitted, the dialog box is horizontally centered.
ypos | Numeric expression that specifies, in twips, the vertical distance of the upper edge of the dialog box from the top of the screen. If ypos is omitted, the dialog box is vertically positioned approximately one-third of the way down the screen.
helpfile | Not Supported
context | Not Supported.

Remarks

If the user clicks OK or presses ENTER, the InputBoxreturns whatever is in the text box. If the user clicks Cancel, thereturns a zero-length string ("").


InStr

Description

Returns the position of the first occurrence of one string within another.

Syntax

InStr([Start, ]string1, string2[, compare])

The InStr yntax has these arguments:

Part | Description
Start | Optional. Numeric expression that sets the Starting position for each search. If omitted, search begins at the first character position. If Start contains Null, an error occurs. The Start argument is required if compare is specified.
string1 | Required. String expression being searched.
string2 | Required. String expression searched for.
compare | Optional. Numeric value indicating the kind of comparison to use when evaluating substrings. See Settings section for values. If omitted, a binary comparison is performed.

Settings

The compare argument can have the following values:

Constant | Value | Description
vbBinaryCompare | 0 | Perform a binary comparison.
vbTextCompare | 1 | Perform a textual comparison.
vbDatabaseCompare | 2 | Perform a comparison based upon information contained in the database where the comparison is to be performed.

Return Values

The Instr returns the following values:

If | InStr returns
string1 is zero-length | 0
string1 is Null | Null
string2 is zero-length | Start
string2 is Null | Null
string2 is not found | 0
string2 is found within string1 | Position at which match is found
Start > Len(string2) | 0

Note The InStrBis used with byte data contained in a string. Instead of returning the character position of the first occurrence of one string within another, InStrB returns the byte position.


InstrRev

Description

Returns the position of an occurrence of one string within another, from the end of string.

Syntax

InstrRev(string1, string2[, Start[, compare]])

The InstrRev syntax has these parts:

Part | Description
string1 | Required. String expression being searched.
string2 | Required. String expression being searched for.
Start | Optional. Numeric expression that sets the Starting position for each search. If omitted, -1 is used, which means that the search begins at the last character position. If Start contains Null, an error occurs.
compare | Optional. Numeric value indicating the kind of comparison to use when evaluating substrings. If omitted, a binary comparison is performed. See Settings section for values.

Settings

The compare argument can have the following values:

Constant | Value | Description
vbBinaryCompare | 0 | Perform a binary comparison.
vbTextCompare | 1 | Perform a textual comparison.
vbDatabaseCompare | 2 | Perform a comparison based upon information contained in the database where the comparison is to be performed.

Return Values

InStrRev returns the following values:

If | InStrRev returns
string1 is zero-length | 0
string1 is Null | Null
string2 is zero-length | Start
string2 is Null | Null
string2 is not found | 0
string2 is found within string1 | Position at which match is found
Start > Len(string2) | 0

Remarks

Note that the syntax for the InstrRev is not the same as the syntax for the Instr function.


Int, Fix

Returns the integer portion of a number.

Syntax

Int(number)

Fix(number)

The number argument can be any valid numeric expression. If number contains Null, Null is returned.

Remarks

Both Int and Fix remove the fractional part of number and return the resulting integer value.

The difference between Int and Fix is that if number is negative, Int returns the first negative integer less than or equal to number, whereas Fix returns the first negative integer greater than or equal to number. For example, Int converts -8.4 to -9, and Fix converts -8.4 to -8.

Fix(number) is equivalent to:

Sgn(number) * Int(Abs(number)Int)


IsArray

Returns a Boolean value indicating whether a variable is an array.

Syntax

IsArray(varname)

The varname argument can be any variable.

Remarks

IsArray returns True if the variable is an array; otherwise, it returns False. IsArray is especially useful with variants containing arrays.


IsDate

Returns a Boolean value indicating whether an expression can be converted to a date.

Syntax

IsDate(expression)

The expression argument can be any date expression or string expression recognizable as a date or time.

Remarks

IsDate returns True if the expression is a date or can be converted to a valid date; otherwise, it returns False. In Microsoft Windows, the range of valid dates is January 1, 100 A.D. through December 31, 9999 A.D.; the ranges vary among operating systems.


IsEmpty

Description

Returns a Boolean value indicating whether a variable has been initialized.

Syntax

IsEmpty(expression)

The expression argument can be any expression. However, because IsEmpty is used to determine if individual variables are initialized, the expression argument is most often a single variable name.

Remarks

IsEmpty returns True if the variable is uninitialized, or is explicitly set to Empty; otherwise, it returns False. False is always returned if expression contains more than one variable.


IsNull

Returns a Boolean value that indicates whether an expression contains no valid data (Null).

Syntax

IsNull(expression)

The expression argument can be any expression.

Remarks

IsNull returns True if expression is Null, that is, it contains no valid data; otherwise, IsNull returns False. If expression consists of more than one variable, Null in any constituent variable causes True to be returned for the entire expression.

The Null value indicates that the variable contains no valid data. Null is not the same as Empty, which indicates that a variable has not yet been initialized. It is also not the same as a zero-length string (""), which is sometimes referred to as a null string.

Important Use the IsNullto determine whether an expression contains a Null value. Expressions that you might expect to evaluate to True under some circumstances, such as If Var = Null and If Var <> Null, are always False. This is because any expression containing a Null is itself Null, and therefore, False.


IsNumeric

Returns a Boolean value indicating whether an expression can be evaluated as a number.

Syntax

IsNumeric(expression)

The expression argument can be any expression.

Remarks

IsNumeric returns True if the entire expression is recognized as a number; otherwise, it returns False.

IsNumeric returns False if expression is a date expression.


IsObject

Returns a Boolean value indicating whether an expression references a valid Automation object.

Syntax

IsObject(expression)

The expression argument can be any expression.

Remarks

IsObject returns True if expression is a variable of Object subtype or a user-defined object; otherwise, it returns False.


Join

Returns a string created by joining a number of substrings contained in an array.

Syntax

Join(list[, delimiter])

The Join syntax has these parts:

Part | Description
list | Required. One-dimensional array containing substrings to be joined.
delimiter | Optional. String character used to separate the substrings in the returned string. If omitted, the space character (" ") is used. If delimiter is a zero-length string, all items in the list are concatenated with no delimiters.


LBound

Returns the smallest available subscript for the indicated dimension of an array.

Syntax

LBound(arrayname[, dimension])

The Lbound syntax has these parts:

Part | Description
arrayname | Name of the array variable; follows standard variable naming conventions.
dimension | Whole number indicating which dimension's lower bound is returned. Use 1 for the first dimension, 2 for the second, and so on. If dimension is omitted, 1 is assumed.

Remarks

The LBoundis used with the UBoundto determine the size of an array. Use the UBoundto find the upper limit of an array dimension.

The default lower bound for any dimension is always 0.


LCase

Description

Returns a string that has been converted to lowercase.

Syntax

LCase(string)

The string argument is any valid string expression. If string contains Null, Null is returned.

Remarks

Only uppercase letters are converted to lowercase; all lowercase letters and nonletter characters remain unchanged.


Left

Description

Returns a specified number of characters from the left side of a string.

Syntax

Left(string, length)

The Left syntax has these arguments:

Part | Description
string | String expression from which the leftmost characters are returned. If string contains Null, Null is returned.
length | Numeric expression indicating how many characters to return. If 0, a zero-length string("") is returned. If greater than or equal to the number of characters in string, the entire string is returned.

Remarks

To determine the number of characters in string, use the Len function.

Note The LeftB is used with byte data contained in a string. Instead of specifying the number of characters to return, length specifies the number of bytes.


Len

Description

Returns the number of characters in a string or the number of bytes required to store a variable.

Syntax

Len(string | varname)

The Lens yntax has these parts:

Part | Description
string | Any valid string expression. If string contains Null, Null is returned.
varname | Any valid variable name. If varname contains Null, Null is returned.

Note The LenB s used with byte data contained in a string. Instead of returning the number of characters in a string, LenB returns the number of bytes used to represent that string.


Log

Returns the natural logarithm of a number.

Syntax

Log(number)

The number argument can be any valid numeric expression greater than 0.

Remarks

The natural logarithm is the logarithm to the base e. The constant e is approximately 2.718282.

You can calculate base-n logarithms for any number x by dividing the natural logarithm of x by the natural logarithm of n as follows:

Logn(x) = Log(x) / Log(n)

The following example illustrates a custom function that calculates base-10 logarithms:

Function Log10(X)
    Log10 = Log(X) / Log(10)
End Function


LTrim, RTrim,Trim

Returns a copy of a string without leading spaces (LTrim), trailing spaces (RTrim), or both leading and trailing spaces (Trim).

Syntax

LTrim(string)

RTrim(string)

Trim(string)

The string argument is any valid string expression. If string contains Null, Null is returned.


Mid

Returns a specified number of characters from a string.

Syntax

Mid(string, Start[, length])

The Mid syntax has these arguments:

Part | Description
string | String expression from which characters are returned. If string contains Null, Null is returned.
Start | Character position in string at which the part to be taken begins. If Start is greater than the number of characters in string, Mid returns a zero-length string ("").
length | Number of characters to return. If omitted or if there are fewer than length characters in the text (including the character at Start), all characters from the Start position to the end of the string are returned.

Remarks

To determine the number of characters in string, use the Len function.

Note The MidB is used with byte data contained in a string. Instead of specifying the number of characters, the arguments specify numbers of bytes.


Minute

Returns a whole number between 0 and 59, inclusive, representing the minute of the hour.

Syntax

Minute(time)

The time argument is any expression that can represent a time. If time contains Null, Null is returned.


Month

Returns a whole number between 1 and 12, inclusive, representing the month of the year.

Syntax

Month(date)

The date argument is any expression that can represent a date. If date contains Null, Null is returned.


MonthName

Returns a string indicating the specified month.

Syntax

MonthName(month[, abbreviate])

The MonthName syntax has these parts:

Part | Description
month | Required. The numeric designation of the month. For example, January is 1, February is 2, and so on.
abbreviate | Optional. Boolean value that indicates if the month name is to be abbreviated. If omitted, the default is False, which means that the month name is not abbreviated.


MsgBox

Displays a message in a dialog box, waits for the user to click a button, and returns a value indicating which button the user clicked.

Syntax

MsgBox(prompt[, buttons][, title][, helpfile, context])

The MsgBox syntax has these arguments:

Part | Description
prompt | String expression displayed as the message in the dialog box. The maximum length of prompt is approximately 1024 characters, depending on the width of the characters used. If prompt consists of more than one line, you can separate the lines using a carriage return character (Chr(13)), a linefeed character (Chr(10)), or carriage return–linefeed character combination (Chr(13) & Chr(10)) between each line.
buttons | Numeric expression that is the sum of values specifying the number and type of buttons to display, the icon style to use, the identity of the default button, and the modality of the message box. See Settings section for values. If omitted, the default value for buttons is 0.
title | String expression displayed in the title bar of the dialog box. If you omit title, the application name is placed in the title bar.
helpfile | Not supported.
context | Not supported.

Settings

The buttons argument settings are:

Constant | Value | Description
vbOKOnly | 0 | Display OK button only.
vbOKCancel | 1 | Display OK and Cancel buttons.
vbAbortRetryIgnore | 2 | Display Abort, Retry, and Ignore buttons.
vbYesNoCancel | 3 | Display Yes, No, and Cancel buttons.
vbYesNo | 4 | Display Yes and No buttons.
vbRetryCancel | 5 | Display Retry and Cancel buttons.
vbCritical | 16 | Display Critical Message icon.
vbQuestion | 32 | Display Warning Query icon.
vbExclamation | 48 | Display Warning Message icon.
vbInformation | 64 | Display Information Message icon.
vbDefaultButton1 | 0 | First button is default.
vbDefaultButton2 | 256 | Second button is default.
vbDefaultButton3 | 512 | Third button is default.
vbDefaultButton4 | 768 | Fourth button is default.
vbApplicationModal | 0 | Application modal; the user must respond to the message box before continuing work in the current application.
vbSystemModal | 4096 | System modal; all applications are suspended until the user responds to the message box.

The first group of values (0–5) describes the number and type of buttons displayed in the dialog box; the second group (16, 32, 48, 64) describes the icon style; the third group (0, 256, 512, 768) determines which button is the default; and the fourth group (0, 4096) determines the modality of the message box. When adding numbers to create a final value for the argument buttons, use only one number from each group.

Return Values

The MsgBoxhas the following return values:

Constant | Value | Button
vbOK | 1 | OK
vbCancel | 2 | Cancel
vbAbort | 3 | Abort
vbRetry | 4 | Retry
vbIgnore | 5 | Ignore
vbYes | 6 | Yes
vbNo | 7 | No

Remarks

If the dialog box displays a Cancel button, pressing the ESC key has the same effect as clicking Cancel.


Now

Description

Returns the current date and time according to the setting of your computer's system date and time.

Syntax

Now


Oct

Returns a string representing the octal value of a number.

Syntax

Oct(number)

The number argument is any valid expression.

Remarks

If number is not already a whole number, it is rounded to the nearest whole number before being evaluated.

If number is | Oct returns
Null | Null.
Empty | Zero (0).
Any other number | Up to 11 octal characters,

You can represent octal numbers directly by preceding numbers in the proper range with &O. For example, &O10 is the octal notation for decimal 8.


Replace

Returns a string in which a specified substring has been replaced with another substring a specified number of times.

Syntax

Replace(expression, find, replacewith[, Start[, count[, compare]]])

The Replace syntax has these parts:

Part | Description
expression | Required. String expression containing substring to replace.
find | Required. Substring being searched for.
replacewith | Required. Replacement substring.
Start | Optional. Position within expression where substring search is to begin. If omitted, 1 is assumed.
count | Optional. Number of substring substitutions to perform. If omitted, the default value is -1, which means make all possible substitutions.
compare | Optional. Numeric value indicating the kind of comparison to use when evaluating substrings. See Settings section for values.

Settings

The compare argument can have the following values:

Constant | Value | Description
vbBinaryCompare | 0 | Perform a binary comparison.
vbTextCompare | 1 | Perform a textual comparison.
vbDatabaseCompare | 2 | Perform a comparison based on information contained in the database where the comparison is to be performed.

Return Values

Replace returns the following values:

If | Replace returns
expression is zero-length | Zero-length string ("").
expression is Null | An error.
find is zero-length | Copy of expression
replacewith is zero-length | Copy of expression with all occurences of find removed.
Start > Len(expression) | Zero-length string.
count is 0 | Copy of expression

Remarks

The return value of the Replace is a string, with substitutions made, that begins at the position specified by Start and and concludes at the end of the expression string. It is not a copy of the original string from Start to finish.


Right

Returns a specified number of characters from the right side of a string.

Syntax

Right(string, length)

The Rightsyntax has these arguments:

Part | Description
string | String expression from which the rightmost characters are returned. If string contains Null, Null is returned.
length | Numeric expression indicating how many characters to return. If 0, a zero-length string is returned. If greater than or equal to the number of characters in string, the entire string is returned.

Remarks

To determine the number of characters in string, use the Len function.

Note The RightB is used with byte data contained in a string. Instead of specifying the number of characters to return, length specifies the number of bytes.


Rnd

Returns a random number.

Syntax

Rnd[(number)]

The number argument can be any valid numeric expression.

Remarks

The Rndreturns a value less than 1 but greater than or equal to 0.

The value of number determines how Rnd generates a random number:

If number is | Rnd generates
Less than zero | The same number every time, using number as the seed.
Greater than zero | The next random number in the sequence.
Equal to zero | The most recently generated number.
Not supplied | The next random number in the sequence.

For any given initial seed, the same number sequence is generated because each successive call to the Rnduses the previous number as a seed for the next number in the sequence.

Before calling Rnd, use the Randomize statement without an argument to initialize the random-number generator with a seed based on the system timer.

To produce random integers in a given range, use this formula:

Int((upperbound - lowerbound + 1) * Rnd + lowerbound)

Here, upperbound is the highest number in the range, and lowerbound is the lowest number in the range.

Note To repeat sequences of random numbers, call Rnd with a negative argument immediately before using Randomize with a numeric argument. Using Randomize with the same value for number does not repeat the previous sequence.


Round

Returns a number rounded to a specified number of decimal places.

Syntax

Round(expression[, numdecimalplaces])

The Round syntax has these parts:

Part | Description
expression | Required. Numeric expression being rounded.
numdecimalplaces | Optional. Number indicating how many places to the right of the decimal are included in the rounding. If omitted, integers are returned by the Round function.


ScriptEngine

Returns a string representing the scripting language in use.

Syntax

ScriptEngine

Return Values

The ScriptEnginecan return any of the following strings:

String | Description
VBScript | Indicates that Microsoft® Visual Basic® Scripting Edition is the current script engine.
JScript | Indicates that Microsoft JScript™ is the current script engine.
VBA | Indicates that Microsoft Visual Basic for Applications is the current script engine.


ScriptEngineBuildVersion

Returns the build version number of the script engine in use.

Syntax

ScriptEngineBuildVersion

Remarks

The return value corresponds directly to the version information contained in the DLL for the scripting language in use.


ScriptEngineMajorVersion

Returns the major version number of the script engine in use.

Syntax

ScriptEngineMajorVersion

Remarks

The return value corresponds directly to the version information contained in the DLL for the scripting language in use.


ScriptEngineMinorVersion

Returns the minor version number of the script engine in use.

Syntax

ScriptEngineMinorVersion

Remarks

The return value corresponds directly to the version information contained in the DLL for the scripting language in use.


Second

Returns a whole number between 0 and 59, inclusive, representing the second of the minute.

Syntax

Second(time)

The time argument is any expression that can represent a time. If time contains Null, Null is returned.


Sgn

Returns an integer indicating the sign of a number.

Syntax

Sgn(number)

The number argument can be any valid numeric expression.

Return Values

The Sgnhas the following return values:

If number is | Sgn returns
Greater than zero | 1
Equal to zero | 0
Less than zero | -1

Remarks

The sign of the number argument determines the return value of the Sgn function.


Sin

Returns the sine of an angle.

Syntax

Sin(number)

The number argument can be any valid numeric expression that expresses an angle in radians.

Remarks

The Sin takes an angle and returns the ratio of two sides of a right triangle. The ratio is the length of the side opposite the angle divided by the length of the hypotenuse. The result lies in the range -1 to 1.

To convert degrees to radians, multiply degrees by pi/180. To convert radians to degrees, multiply radians by 180/pi.


Space

Returns a string consisting of the specified number of spaces.

Syntax

Space(number)

The number argument is the number of spaces you want in the string.


Split

Returns a zero-based, one-dimensional array containing a specified number of substrings.

Syntax

Split(expression[, delimiter[, count[, compare]]])

The Split syntax has these parts:

Part | Description
expression | Required. String expression containing substrings and delimiters. If expression is a zero-length string, Split returns an empty array, that is, an array with no elements and no data.
delimiter | Optional. String character used to identify substring limits. If omitted, the space character (" ") is assumed to be the delimiter. If delimiter is a zero-length string, a single-element array containing the entire expression string is returned.
count | Optional. Number of substrings to be returned; -1 indicates that all substrings are returned.
compare | Optional. Numeric value indicating the kind of comparison to use when evaluating substrings. See Settings section for values.

Settings

The compare argument can have the following values:

Constant | Value | Description
vbBinaryCompare | 0 | Perform a binary comparison.
vbTextCompare | 1 | Perform a textual comparison.
vbDatabaseCompare | 2 | Perform a comparison based on information contained in the database where the comparison is to be performed.


Sqr

Returns the square root of a number.

Syntax

Sqr(number)

The number argument can be any valid numeric expression greater than or equal to 0.


StrComp

Returns a value indicating the result of a string comparison.

Syntax

StrComp(string1, string2[, compare])

The StrCompsyntax has these arguments:

Part | Description
string1 | Required. Any valid string expression.
string2 | Required. Any valid string expression.
compare | Optional. Numeric value indicating the kind of comparison to use when evaluating strings. If omitted, a binary comparison is performed. See Settings section for values.

Settings

The compare argument can have the following values:

Constant | Value | Description
vbBinaryCompare | 0 | Perform a binary comparison.
vbTextCompare | 1 | Perform a textual comparison.
vbDatabaseCompare | 2 | Not supported.

Return Values

The StrComphas the following return values:

If | StrComp returns
string1 is less than string2 | -1
string1 is equal to string2 | 0
string1 is greater than string2 | 1
string1 or string2 is Null | Null


StrReverse

Returns a string in which the character order of a specified string is reversed.

Syntax

StrReverse(string1)

The string1 argument is the string whose characters are to be reversed. If string1 is a zero-length string (""), a zero-length string is returned. If string1 is Null, an error occurs.


String

Returns a repeating character string of the length specified.

Syntax

String(number, character)

The Stringsyntax has these arguments:

Part | Description
number | Length of the returned string. If number contains Null, Null is returned.
character | Character code specifying the character or string expression whose first character is used to build the return string. If character contains Null, Null is returned.

Remarks

If you specify a number for character greater than 255, String converts the number to a valid character code using the formula:

character Mod 256


Tan

Returns the tangent of an angle.

Syntax

Tan(number)

The number argument can be any valid numeric expression that expresses an angle in radians.

Remarks

Tan takes an angle and returns the ratio of two sides of a right triangle. The ratio is the length of the side opposite the angle divided by the length of the side adjacent to the angle.

To convert degrees to radians, multiply degrees by pi/180. To convert radians to degrees, multiply radians by 180/pi.


Time

Returns a Variant of subtype Date indicating the current system time.

Syntax

Time


TimeSerial

Returns a Variant of subtype Date containing the time for a specific hour, minute, and second.

Syntax

TimeSerial(hour, minute, second)

The TimeSerial syntax has these arguments:

Part | Description
hour | Number between 0 (12:00 A.M.) and 23 (11:00 P.M.), inclusive, or a numeric expression.
minute | Any numeric expression.
second | Any numeric expression.

Remarks

To specify a time, such as 11:59:59, the range of numbers for each TimeSerial argument should be in the accepted range for the unit; that is, 0–23 for hours and 0–59 for minutes and seconds. However, you can also specify relative times for each argument using any numeric expression that represents some number of hours, minutes, or seconds before or after a certain time. The following example uses expressions instead of absolute time numbers. The TimeSerialreturns a time for 15 minutes before (-15) six hours before noon (12 - 6), or 5:45:00 A.M.

TimeSerial(12 - 6, -15, 0)

When any argument exceeds the accepted range for that argument, it increments to the next larger unit as appropriate. For example, if you specify 75 minutes, it is evaluated as one hour and 15 minutes. However, if any single argument is outside the range -32,768 to 32,767, or if the time specified by the three arguments, either directly or by expression, causes the date to fall outside the acceptable range of dates, an error occurs.


TimeValue

Returns a Variant of subtype Date containing the time.

Syntax

TimeValue(time)

The time argument is usually a string expression representing a time from 0:00:00 (12:00:00 A.M.) to 23:59:59 (11:59:59 P.M.), inclusive. However, time can also be any expression that represents a time in that range. If time contains Null, Null is returned.

Remarks

You can enter valid times using a 12-hour or 24-hour clock. For example, "2:24PM" and "14:24" are both valid time arguments.

If the time argument contains date information, TimeValue doesn't return the date information. However, if time includes invalid date information, an error occurs.


TypeName Function

TypeName

Description

Returns a string that provides Variant subtype information about a variable.

Syntax

TypeName(varname)

The required varname argument can be any variable.

Return Values

The TypeName has the following return values:

Value | Description
Byte | Byte value
Integer | Integer value
Long | Long integer value
Single | Single-precision floating-point value
Double | Double-precision floating-point value
Currency | Currency value
Decimal | Decimal value
Date | Date or time value
String | Character string value
Boolean | Boolean value; True or False
Empty | Unitialized
Null | No valid data
&ltobject type> | Actual type name of an object
Object | Generic object
Unknown | Unknown object type
Nothing | Object variable that doesn't yet refer to an object instance
Error | Error


UBound

Returns the largest available subscript for the indicated dimension of an array.

Syntax

UBound(arrayname[, dimension])

The Ubound syntax has these parts:

Part | Description
arrayname | Required. Name of the array variable; follows standard variable naming conventions.
dimension | Optional. Whole number indicating which dimension's upper bound is returned. Use 1 for the first dimension, 2 for the second, and so on. If dimension is omitted, 1 is assumed.

Remarks

The Ubound is used with the Lbound to determine the size of an array. Use the LBoundto find the lower limit of an array dimension.

The default lower bound for any dimension is always 0. As a result, UBound returns the following values for an array with these dimensions:

Dim A(100,3,4)

Statement | Return Value
UBound(A,1) | 99
UBound(A,2) | 2
UBound(A,3) | 3


UCase

Returns a string that has been converted to uppercase.

Syntax

UCase(string)

The string argument is any valid string expression. If string contains Null, Null is returned.

Remarks

Only lowercase letters are converted to uppercase; all uppercase letters and nonletter characters remain unchanged.


VarType

Description

Returns a value indicating the subtype of a variable.

Syntax

VarType(varname)

The varname argument can be any variable.

Return Values

The VarType returns the following values:

Constant | Value | Description
vbEmpty | 0 | Empty (uninitialized)
vbNull | 1 | Null (no valid data)
vbInteger | 2 | Integer
vbLong | 3 | Long integer
vbSingle | 4 | Single-precision floating-point number
vbDouble | 5 | Double-precision floating-point number
vbCurrency | 6 | Currency
vbDate | 7 | Date
vbString | 8 | String
vbObject | 9 | Automation object
vbError | 10 | Error
vbBoolean | 11 | Boolean
vbVariant | 12 | Variant (used only with arrays of Variants)
vbDataObject | 13 | A data-access object
vbByte | 17 | Byte
vbArray | 8192 | Array

Note These constants are specified by Visual Basic for Windows CE run time. As a result, the names can be used anywhere in your code in place of the actual values.

Remarks

The VarTypenever returns the value for Array by itself. It is always added to some other value to indicate an array of a particular type. The value for Variant is only returned when it has been added to the value for Array to indicate that the argument to the VarType is an array. For example, the value returned for an array of integers is calculated as 2 + 8192, or 8194. If an object has a default property, VarType (object) returns the type of its default property.


Weekday

Returns a whole number representing the day of the week.

Syntax

Weekday(date, [firstdayofweek])

The Weekday syntax has these arguments:

Part | Description
date | Any expression that can represent a date. If date contains Null, Null is returned.
firstdayofweek | A constant that specifies the first day of the week. If omitted, vbSunday is assumed.

Settings

The firstdayofweek argument has these settings:

Constant | Value | Description
vbUseSystem | 0 | Use National Language Support (NLS) API setting.
vbSunday | 1 | Sunday
vbMonday | 2 | Monday
vbTuesday | 3 | Tuesday
vbWednesday | 4 | Wednesday
vbThursday | 5 | Thursday
vbFriday | 6 | Friday
vbSaturday | 7 | Saturday

Return Values

The Weekday can return any of these values:

Constant | Value | Description
vbSunday | 1 | Sunday
vbMonday | 2 | Monday
vbTuesday | 3 | Tuesday
vbWednesday | 4 | Wednesday
vbThursday | 5 | Thursday
vbFriday | 6 | Friday
vbSaturday | 7 | Saturday


WeekDayName

Returns a string indicating the specified day of the week.

Syntax

WeekDayName(weekday, abbreviate, firstdayofweek)

The WeekDayName syntax has these parts:

Part | Description
weekday | Required. The numeric designation for the day of the week. Numeric value of each day depends on setting of the firstdayofweek setting.
abbreviate | Optional. Boolean value that indicates if the weekday name is to be abbreviated. If omitted, the default is False, which means that the weekday name is not abbreviated.
firstdayofweek | Optional. Numeric value indicating the first day of the week. See Settings section for values.

Settings

The firstdayofweek argument can have the following values:

Constant | Value | Description
vbUseSystem | 0 | Use National Language Support (NLS) API setting.
vbSunday | 1 | Sunday (default)
vbMonday | 2 | Monday
vbTuesday | 3 | Tuesday
vbWednesday | 4 | Wednesday
vbThursday | 5 | Thursday
vbFriday | 6 | Friday
vbSaturday | 7 | Saturday


Year

Returns a whole number representing the year.

Syntax

Year(date)

The date argument is any expression that can represent a date. If date contains Null, Null is returned.


Constants

Constants

ADO Error

Color

CommDlg Error

Comparison

Date and Time

Date Format

Miscellaneous

MsgBox

String

VarType


ADO Error

ADO can return the following specific errors. As a general rule, these errors will never mask an underlying database error. For example, adErrItemNotFound won't be returned from the Fields collection for a missing field if there is an underlying database error.

The errors below have a facility code of "0xA" thus leading to an hresult prefix of "800A".

Constant | Number | Description
adErrInvalidArgument | 3001 | You are using arguments that are of the wrong type, are out of acceptable range, or are in conflict with one another.
adErrNoCurrentRecord | 3021 | Either BOF or EOF is True, or the current record has been deleted; the operation you requested requires a current record.
adErrIllegalOperation | 3219 | The operation you requested is not allowed in this context.
adErrFeatureNotAvailable | 3251 | The operation you requested is not supported by the provider.
adErrItemNotFound | 3265 | ADO could not find the object in the collection corresponding to the requested name or ordinal reference.
adErrObjectNotSet | 3420 | The object reference you are using no longer points to a valid object.
adErrDataConversion | 3421 | You are using a value of the wrong type for the current operation.
adErrObjectClosed | 3704 | The operation you requested is not allowed if the object is closed.
adErrObjectOpen | 3705 | The operation you requested is not allowed if the object is open.
adErrProviderNotFound | 3706 | ADO could not find the specified provider.
adErrInvalidParamInfo | 3708 | You have improperly defined a ParameteradobjParameter object.
adErrInvalidConnection | 3709 | You requested an operation on an object with a reference to a closed or invalid Connection object.

These ADO errors will not occur: adErrInTransaction, adErrBoundToCommand.

The above errors appear differently from the OLE DB-style errors that the SQL parser / engine produces (which have a facility code of 4) since VB strips off facility codes of A of leaving just the lower 2 bytes of error code displayed to the user.

Errors have an associated error text. The text is stored and retrieved using the IErrorInfo interface. VB uses this to fill its Err object. ADO errors will not provide Helpfile or HelpContext information.


Color

The following color constants can be used anywhere in your code in place of actual values:

Constant | Value | Description
vbBlack | &h00 | Black
vbRed | &hFF | Red
vbGreen | &hFF00 | Green
vbYellow | &hFFFF | Yellow
vbBlue | &hFF0000 | Blue
vbMagenta | &hFF00FF | Magenta
Cyan | &hFFFF00 | Cyan
vbWhite | &hFFFFFF | White


CommDlg Error

The following common dialog error constants can be used anywhere in your code in place of actual values:

Value | Description
&H7FF0 | Couldn't allocate memory for FileName or Filter property
&H7FF3 | Cancel was selected
&H8000 | The function failed to load the dialog box
&H7FF9 | The function failed to load a specified resource
&H7FEF | Call to Windows Help failed
&H7FFD | The function failed during initialization
&H7FF8 | The function failed to load a specified string
&H7FF7 | The function failed to lock a specified resource
&H7FF6 | The function was unable to allocate memory for internal data structures
&H0009 | The common dialog box function was unable to read from registry.


Comparison

The following comparison constants can be used anywhere in your code in place of actual values:

Constant | Value | Description
vbBinaryCompare | 0 | Perform a binary comparison.
vbTextCompare | 1 | Perform a textual comparison.
vbDatabaseCompare | 2 | Not supported.


Date and Time

The following date and time constants can be used anywhere in your code in place of actual values:

Constant | Value | Description
vbSunday | 1 | Sunday
vbMonday | 2 | Monday
vbTuesday | 3 | Tuesday
vbWednesday | 4 | Wednesday
vbThursday | 5 | Thursday
vbFriday | 6 | Friday
vbSaturday | 7 | Saturday
vbFirstJan1 | 1 | Use the week in which January 1 occurs (default).
vbFirstFourDays | 2 | Use the first week that has at least four days in the new year.
vbFirstFullWeek | 3 | Use the first full week of the year.
vbUseSystem | 0 | Use the date format contained in the regional settings for your computer.
vbUseSystemDayOfWeek | 0 | Use the day of the week specified in your system settings for the first day of the week.


Date Format

The following date format constants can be used anywhere in your code in place of actual values:

Constant | Value | Description
vbGeneralDate | 0 | Display a date and/or time. For real numbers, display a data and time. If there is no fractional part, display only a date. If there is no integer part, display time only. Date and time display is determined by your system settings.
vbLongDate | 1 | Display a date using the long date format specified in your computer's regional settings.
vbShortDate | 2 | Display a date using the short date format specified in your computer's regional settings.
vbLongTime | 3 | Display a time using the long time format specified in your computer's regional settings.
vbShortTime | 4 | Display a time using the short time format specified in your computer's regional settings.


Miscellaneous

The following miscellaneous constants can be used anywhere in your code in place of actual values:

Constant | Value | Description
vbObjectError | &h80040000 |


MsgBox

The following constants are used with the MsgBox function to identify what buttons and icons appear on a message box and which button is the default. In addition, the modality of the MsgBox can be specified. These constants can be used anywhere in your code in place of actual values:

Constant | Value | Description
vbOKOnly | 0 | Display OK button only.
vbOKCancel | 1 | Display OK and Cancel buttons.
vbAbortRetryIgnore | 2 | Display Abort, Retry, and Ignore buttons.
vbYesNoCancel | 3 | Display Yes, No, and Cancel buttons.
vbYesNo | 4 | Display Yes and No buttons.
vbRetryCancel | 5 | Display Retry and Cancel buttons.
vbCritical | 16 | Display Critical Message icon.
vbQuestion | 32 | Display Warning Query icon.
vbExclamation | 48 | Display Warning Message icon.
vbInformation | 64 | Display Information Message icon.
vbDefaultButton1 | 0 | First button is the default.
vbDefaultButton2 | 256 | Second button is the default.
vbDefaultButton3 | 512 | Third button is the default.
vbDefaultButton4 | 768 | Fourth button is the default.
vbApplicationModal | 0 | Application modal. The user must respond to the message box before continuing work in the current application.
vbSystemModal | 4096 | System modal. All applications are suspended until the user responds to the message box.

The following constants are used with the MsgBox function to identify which button a user has selected. These constants can be used anywhere in your code in place of actual values:

Constant | Value | Description
vbOK | 1 | OK button was clicked.
vbCancel | 2 | Cancel button was clicked.
vbAbort | 3 | Abort button was clicked.
vbRetry | 4 | Retry button was clicked.
vbIgnore | 5 | Ignore button was clicked.
vbYes | 6 | Yes button was clicked.
vbNo | 7 | No button was clicked.


String

The following string constants can be used anywhere in your code in place of actual values:

Constant | Value | Description
vbCr | Chr(13) | Carriage return
vbCrLf | Chr(13) & Chr(10) | Carriage return–linefeed combination
vbFormFeed | Chr(12) | Form feed; not useful in Microsoft Windows
vbLf | Chr(10) | Line feed
vbNewLine | Chr(13) & Chr(10) or Chr(10) | Platform-specific newline character; whatever is appropriate for the platform
vbNullChar | Chr(0) | Character having the value 0
vbNullString | String having value 0 | Not the same as a zero-length string (""); used for calling external procedures
vbTab | Chr(9) | Horizontal tab
vbVerticalTab | Chr(11) | Vertical tab; not useful in Microsoft Windows


VarType

The following VarType constants can be used anywhere in your code in place of actual values:

Constant | Value | Description
vbEmpty | 0 | Uninitialized (Default)
vbNull | 1 | Contains no valid data
vbInteger | 2 | Integer subtype
vbLong | 3 | Long subtype
vbSingle | 4 | Single subtype
vbDouble | 5 | Double subtype
vbCurrency | 6 | Currency subtype
vbDate | 7 | Date subtype
vbString | 8 | String subtype
vbObject | 9 | Object
vbError | 10 | Error subtype
vbBoolean | 11 | Boolean subtype
vbVariant | 12 | Variant (used only for arrays of variants)
vbDataObject | 13 | Data access object
vbDecimal | 14 | Decimal subtype
vbByte | 17 | Byte subtype
vbArray | 8192 | Array


Statements

Statements

Call

Const

Dim

Do...Loop

Erase

Exit

For...Next

For Each...Next

Function

If...Then...Else

On Error

Option Explicit

Private

Public

Randomize

ReDim

Rem

Select Case

Set

Sub

While...Wend


Call

Transfers control to a Sub procedure or Function procedure.

Syntax

[Call] name [argumentlist]

The Call statement syntax has these parts:

Part | Description
Call | Optional keyword. If specified, you must enclose argumentlist in parentheses. For example: Call MyProc(0)
name | Required. Name of the procedure to call.
argumentlist | Optional. Comma-delimited list of variables, arrays, or expressions to pass to the procedure.

Remarks

You are not required to use the Call keyword when calling a procedure. However, if you use the Call keyword to call a procedure that requires arguments, argumentlist must be enclosed in parentheses. If you omit the Call keyword, you also must omit the parentheses around argumentlist. If you use either Call syntax to call any intrinsic or user-defined function, the function's return value is discarded.


Const

Declares constants for use in place of literal values.

Syntax

[Public | Private] Const constname = expression

The Const statement syntax has these parts:

Part | Description
Public | Optional. Keyword used at module level to declare constants that are available to all procedures in all modules. Not allowed in procedures.
Private | Optional. Keyword used at module level to declare constants that are available only within the module where the declaration is made. Not allowed in procedures.
constname | Required. Name of the constant; follows standard variable naming conventions.
expression | Required. Literal or other constant, or any combination that includes all arithmetic or logical operators except Is.

Remarks

Constants are public by default. Within procedures, constants are always private; their visibility can't be changed. Within a module, the default visibility of a module -level constant can be changed using the Private keyword.

To combine several constant declarations on the same line, separate each constant assignment with a comma. When constant declarations are combined in this way, the Public or Private keyword, if used, applies to all of them.

You can't use variables, user-defined functions, or intrinsic Visual Basic for Windows CE run-time functions (such as Chr) in constant declarations. By definition, they can't be constants. You also can't create a constant from any expression that involves an operator, that is, only simple constants are allowed. Constants declared in a Sub or Function procedure are local to that procedure. A constant declared outside a procedure is defined throughout the module in which it is declared. You can use constants anywhere you can use an expression.

Note Constants can make your code self-documenting and easy to modify. Unlike variables, constants can't be inadvertently changed while your program is running.


Dim

Declares variables and allocates storage space.

Syntax

Dim varname[([subscripts])][, varname[([subscripts])]] . . .

The Dim statement syntax has these parts:

Part | Description
varname | Name of the variable; follows standard variable naming conventions.
subscripts Dimensions of an array variable; up to 60 multiple dimensions may be declared. The subscripts argument uses the following syntax:
upperbound [,upperbound] . . .

The lower bound of an array is always zero.

Remarks

Variables declared with Dim at the module level are available to all procedures within the module. At the procedure level, variables are available only within the procedure.

You can also use the Dim statement with empty parentheses to declare a dynamic array. After declaring a dynamic array, use the ReDim statement within a procedure to define the number of dimensions and elements in the array. If you try to redeclare a dimension for an array variable whose size was explicitly specified in a Dim statement, an error occurs.

When variables are initialized, a numeric variable is initialized to 0 and a string is initialized to a zero-length string (""). When you use the Dim statement in a procedure, you generally put the Dim statement at the beginning of the procedure.


Do...Loop

Repeats a block of statements while a condition is True or until a condition becomes True.

Syntax

Do [{While | Until} condition]
[statements]
[Exit Do]
[statements]
Loop

Or, you can use this syntax:

Do
[statements]
[Exit Do]
[statements]
Loop [{While | Until} condition]

The Do...Loop statement syntax has these parts:

Part | Description
condition | Numeric or string expression that is True or False. If condition is Null, condition is treated as False.
statements | One or more statements that are repeated while or until condition is True.

Remarks

The Exit Do can only be used within a Do...Loop control structure to provide an alternate way to exit a Do...Loop. Any number of Exit Do statements may be placed anywhere in the Do...Loop. Often used with the evaluation of some condition (for example, If...Then), Exit Do transfers control to the statement immediately following the Loop.

When used within nested Do...Loop statements, Exit Do transfers control to the loop that is one nested level above the loop where it occurs.


Erase

Reinitializes the elements of fixed-size arrays and deallocates dynamic-array storage space.

Syntax

Erase array

The array argument is the name of the array variable to be erased.

Remarks

It is important to know whether an array is fixed-size (ordinary) or dynamic because Erase behaves differently depending on the type of array. Erase recovers no memory for fixed-size arrays. Erase sets the elements of a fixed array as follows:

Type of array | Effect of Erase on fixed-array elements
Fixed number array | Sets each element to zero.
Fixed string array | Sets each element to sero-length ("")
Array of objects | Sets each element to the special value Nothing.

Erase frees the memory used by dynamic arrays. Before your program can refer to the dynamic array again, it must redeclare the array variable's dimensions using a ReDim statement.


Exit

Exits a block of Do...Loop, For...Next, Function, or Sub code.

Syntax

Exit Do

Exit For

Exit Function

Exit Sub

The Exit statement syntax has these forms:

Statement | Description
Exit Do | Provides a way to exit a Do...Loop statement. It can be used only inside a Do...Loop statement. Exit Do transfers control to the statement following the Loop statement. When used within nested Do...Loop statements, Exit Do transfers control to the loop that is one nested level above the loop where it occurs.
Exit For | Provides a way to exit a For loop. It can be used only in a For...Next or For Each...Next loop. Exit For transfers control to the statement following the Next statement. When used within nested For loops, Exit For transfers control to the loop that is one nested level above the loop where it occurs.
Exit Function | Immediately exits the Function procedure in which it appears. Execution continues with the statement following the statement that called the Function.
Exit Sub | Immediately exits the Sub procedure in which it appears. Execution continues with the statement following the statement that called the Sub.


For...Next

Repeats a group of statements a specified number of times.

Syntax

For counter = start To end [Step step]
[statements]
[Exit For]
[statements]
Next

The For...Next statement syntax has these parts:

Part | Description
counter | Numeric variable used as a loop counter. The variable can't be an array element or an element of a user-defined type.
start | Initial value of counter.
end | Final value of counter.
step | Amount counter is changed each time through the loop. If not specified, step defaults to one.
statements | One or more statements between For and Next that are executed the specified number of times.

Remarks

The step argument can be either positive or negative. The value of the step argument determines loop processing as follows:

Value | Loop executes if
Positive or 0 | counter <= end
Negative | counter >= end

Once the loop starts and all statements in the loop have executed, step is added to counter. At this point, either the statements in the loop execute again (based on the same test that caused the loop to execute initially), or the loop is exited and execution continues with the statement following the Next statement. Changing the value of counter while inside a loop can make it more difficult to read and debug your code.

Exit For can only be used within a For Each...Next or For...Next control structure to provide an alternate way to exit. Any number of Exit For statements may be placed anywhere in the loop. Exit For is often used with the evaluation of some condition (for example, If...Then), and transfers control to the statement immediately following Next.

You can nest For...Next loops by placing one For...Next loop within another. Give each loop a unique variable name as its counter. The following construction is correct:

For I = 1 To 10
    For J = 1 To 10
        For K = 1 To 10
        . . .
        Next
    Next
Next

Note Optional counters on the next statement aren't supported: Next I will generate a compile-time error.


For Each...Next

Repeats a group of statements for each element in an array or collection.

Syntax

For Each element In group
[statements]
[Exit For]
[statements]
Next [element]

The For Each...Next statement syntax has these parts:

Part | Description
element | Variable used to iterate through the elements of the collection or array. For collections, element can only be a Variant variable, a generic Object variable, or any specific Automation object.
group | Name of an object collection or array.
statement | One or more statements that are executed on each item in group.

Remarks

The For Each block is entered if there is at least one element in group. Once the loop has been entered, all the statements in the loop are executed for the first element in group. As long as there are more elements in group, the statements in the loop continue to execute for each element. When there are no more elements in group, the loop is exited and execution continues with the statement following the Next statement.

The Exit For can only be used within a For Each...Next or For...Next control structure to provide an alternate way to exit. Any number of Exit For statements may be placed anywhere in the loop. The Exit For is often used with the evaluation of some condition (for example, If...Then), and transfers control to the statement immediately following Next.

You can nest For Each...Next loops by placing one For Each...Next loop within another. However, each loop element must be unique.

If you omit element in a Next statement, execution continues as if you had included it. If a Next statement is encountered before its corresponding For statement, an error occurs.


Function

Declares the name, arguments, and code that form the body of a Function procedure.

Syntax

[Public | Private] Function name [(arglist)]
[statements]
[name = expression]
[Exit Function]
[statements]
[name = expression]
End Function

The Function statement syntax has these parts:

Part | Description
Public | Indicates that the Function procedure is accessible to all other procedures in all modules.
Private | Indicates that the Function procedure is accessible only to other procedures in the module where it is declared
name | Name of the Function; follows standard variable naming conventions.
arglist | List of variables representing arguments that are passed to the Function procedure when it is called. Multiple variables are separated by commas.
statements | Any group of statements to be executed within the body of the Function procedure.
expression | Return value of the Function.

The arglist argument has the following syntax and parts:

[ByVal | ByRef] varname[( )]

Part | Description
ByVal | Indicates that the argument is passed by value.
Byref | Indicates that the argument is passed by reference.
varname | Name of the variable representing the argument; follows standard variable naming conventions.

Remarks

If not explicitly specified using either Public or Private, Function procedures are public by default, that is, they are visible to all other procedures in your module. The value of local variables in a Function is not preserved between calls to the procedure.

All executable code must be contained in procedures. You can't define a Function procedure inside another Function or Sub procedure.

The Exit Function statement causes an immediate exit from a Function procedure. Program execution continues with the statement following the statement that called the Function procedure. Any number of Exit Function statements can appear anywhere in a Function procedure.

Like a Sub procedure, a Function procedure is a separate procedure that can take arguments, perform a series of statements, and change the values of its arguments. However, unlike a Sub procedure, you can use a Function procedure on the right side of an expression in the same way you use any intrinsic function, such as Sqr, Cos, or Chr, when you want to use the value returned by the function.

You call a Function procedure using the function name, followed by the argument list in parentheses, in an expression. See the Call statement for specific information on how to call Function procedures.

Function procedures can be recursive; that is, they can call themselves to perform a given task. However, recursion can lead to stack overflow.

To return a value from a function, assign the value to the function name. Any number of such assignments can appear anywhere within the procedure. If no value is assigned to name, the procedure returns a default value: a numeric function returns 0 and a string function returns a zero-length string (""). A function that returns an object reference returns Nothing if no object reference is assigned to name (using Set) within the Function.

The following example shows how to assign a return value to a function named BinarySearch. In this case, False is assigned to the name to indicate that some value was not found.

Function BinarySearch(. . .)
    . . .
    ' Value not found. Return a value of False.
    If lower > upper Then
        BinarySearch = False
        Exit Function
    End If
    . . .
End Function

Variables used in Function procedures fall into two categories: those that are explicitly declared within the procedure and those that are not. Variables that are explicitly declared in a procedure (using Dim or the equivalent) are always local to the procedure. Variables that are used but not explicitly declared in a procedure are also local unless they are explicitly declared at some higher level outside the procedure.

A procedure can use a variable that is not explicitly declared in the procedure, but a naming conflict can occur if anything you have defined at the module level has the same name. If your procedure refers to an undeclared variable that has the same name as another procedure, constant, or variable, it is assumed that your procedure is referring to that module-level name. Explicitly declare variables to avoid this kind of conflict. You can use an Option Explicit statement to force explicit declaration of variables.

Visual Basic for Windows CE run time may rearrange arithmetic expressions to increase internal efficiency. Avoid using a Function procedure in an arithmetic expression when the function changes the value of variables in the same expression.


If...Then...Else

Conditionally executes a group of statements, depending on the value of an expression.

Syntax

If condition Then statements [Else elsestatements ]

Or, you can use the block form syntax:

If condition Then
[statements]
[ElseIf condition-n Then
[elseifstatements]] . . .
[Else
[elsestatements]]
End If

The If...Then...Else statement syntax has these parts:

Part | Description
condition One or more of the following two types of expressions:

A numeric or string expression that evaluates to True or False. If condition is Null, condition is treated as False.

An expression of the form TypeOf objectname Is objecttype. The objectname is any object reference and objecttype is any valid object type. The expression is True if objectname is of the object type specified by objecttype; otherwise it is False.
statement | One or more statements separated by colons; executed if condition is True.
condition-n | Same as condition.
elseifstatement | One or more statements executed if the associated condition-n is True.
elsestatement | One or more statements executed if no previous condition or condition-n expression is True.

Remarks

You can use the single-line form (first syntax) for short, simple tests. However, the block form (second syntax) provides more structure and flexibility than the single-line form and is usually easier to read, maintain, and debug.

With the single-line syntax, it is possible to have multiple statements executed as the result of an If...Then decision, but they must all be on the same line and separated by colons, as in the following statement:

If A > 10 Then A = A + 1 : B = B + A : C = C + B

When executing a block If (second syntax), condition is tested. If condition is True, the statements following Then are executed. If condition is False, each ElseIf (if any) is evaluated in turn. When a True condition is found, the statements following the associated Then are executed. If none of the ElseIf statements are True (or there are no ElseIf clauses), the statements following Else are executed. After executing the statements following Then or Else, execution continues with the statement following End If.

The Else and ElseIf clauses are both optional. You can have as many ElseIf statements as you want in a block If, but none can appear after the Else clause. Block If statements can be nested; that is, contained within one another.

What follows the Then keyword is examined to determine whether or not a statement is a block If. If anything other than a comment appears after Then on the same line, the statement is treated as a single-line If statement.

A block If statement must be the first statement on a line. The block If must end with an End If statement.


On Error

Enables error-handling.

Syntax

On Error Resume Next

Remarks

If you don't use an On Error Resume Next statement, any run-time error that occurs is fatal; that is, an error message is displayed and execution stops.

On Error Resume Next causes execution to continue with the statement immediately following the statement that caused the run-time error, or with the statement immediately following the most recent call out of the procedure containing the On Error Resume Next statement. This allows execution to continue despite a run-time error. You can then build the error-handling routine inline within the procedure. An On Error Resume Next statement becomes inactive when another procedure is called, so you should execute an On Error Resume Next statement in each called routine if you want inline error handling within that routine.


Option Explicit

Used at script level to force explicit declaration of all variables in that script.

Syntax

Option Explicit

Remarks

If used, the Option Explicit statement must appear in a module before any procedures.

When you use the Option Explicit statement, you must explicitly declare all variables using the Dim, Private, Public, or ReDim statements. If you attempt to use an undeclared variable name, an error occurs.

Use Option Explicit to avoid incorrectly typing the name of an existing variable or to avoid confusion in code where the scope of the variable is not clear.


Private

Used at module level to declare private variables and allocate storage space.

Syntax

Private varname[([subscripts])][, varname[([subscripts])]] . . .

The Private statement syntax has these parts:

Part | Description
varname | Name of the variable; follows standard variable naming conventions.
subscripts Dimensions of an array variable; up to 60 multiple dimensions may be declared. The subscripts argument uses the following syntax:
upper [, upper] . . .

The lower bound of an array is always zero.

Remarks

Private variables are available only to the module in which they are declared.

A variable that refers to an object must be assigned an existing object using the Set statement before it can be used. Until it is assigned an object, the declared object variable has the special value Nothing.

You can also use the Private statement with empty parentheses to declare a dynamic array. After declaring a dynamic array, use the ReDim statement within a procedure to define the number of dimensions and elements in the array. If you try to redeclare a dimension for an array variable whose size was explicitly specified in a Private, Public, or Dim statement, an error occurs.

When variables are initialized, a numeric variable is initialized to 0 and a string is initialized to a zero-length string ("").

When you use the Private statement in a procedure, you generally put the Private statement at the beginning of the procedure.


Public

Used at module level to declare public variables and allocate storage space.

Syntax

Public varname[([subscripts])][, varname[([subscripts])]] . . .

The Public statement syntax has these parts:

Part | Description
varname | Name of the variable; follows standard variable naming conventions.
subscripts Dimensions of an array variable; up to 60 multiple dimensions may be declared. The subscripts argument uses the following syntax:
upper [, upper] . . .

The lower bound of an array is always zero.

Remarks

Variables declared using the Public statement are available to all procedures in all forms in all projects.

A variable that refers to an object must be assigned an existing object using the Set statement before it can be used. Until it is assigned an object, the declared object variable has the special value Nothing.


Randomize

Initializes the random-number generator.

Syntax

Randomize [number]

The number argument can be any valid numeric expression.

Remarks

Randomize uses number to initialize the Rnd function's random-number generator, giving it a new seed value. If you omit number, the value returned by the system timer is used as the new seed value.

If Randomize is not used, the Rnd function (with no arguments) uses the same number as a seed the first time it is called, and thereafter uses the last generated number as a seed value.

Note To repeat sequences of random numbers, call Rnd with a negative argument immediately before using Randomize with a numeric argument. Using Randomize with the same value for number does not repeat the previous sequence.


ReDim

Used at procedure level to declare dynamic-array variables and allocate or reallocate storage space.

Syntax

ReDim [Preserve] varname(subscripts) [, varname(subscripts)] . . .

The ReDim statement syntax has these parts:

Part | Description
Preserve | Preserves the data in an existing array when you change the size of the last dimension.
varname | Name of the variable; follows standard variable naming conventions.
subscripts Dimensions of an array variable; up to 60 multiple dimensions may be declared. The subscripts argument uses the following syntax:
upper [, upper] . . .

The lower bound of an array is always zero.

Remarks

The ReDim statement is used to size or resize a dynamic array that has already been formally declared using a Private, Public, or Dim statement with empty parentheses (without dimension subscripts). You can use the ReDim statement repeatedly to change the number of elements and dimensions in an array.

If you use the Preserve keyword, you can resize only the last array dimension, and you can't change the number of dimensions at all. For example, if your array has only one dimension, you can resize that dimension because it is the last and only dimension. However, if your array has two or more dimensions, you can change the size of only the last dimension and still preserve the contents of the array. If you make an array smaller than it was originally, data in the eliminated elements is lost.The following example shows how you can increase the size of the last dimension of a dynamic array without erasing any existing data contained in the array.

ReDim X(10, 10, 10)
. . .
ReDim Preserve X(10, 10, 15)

When variables are initialized, a numeric variable is initialized to 0 and a string variable is initialized to a zero-length string (""). A variable that refers to an object must be assigned an existing object using the Set statement before it can be used. Until it is assigned an object, the declared object variable has the special value Nothing.


Rem

Used to include explanatory remarks in a program.

Syntax

Rem comment

or

' comment

The comment argument is the text of any comment you want to include. After the Rem keyword, a space is required before comment.

Remarks

As shown in the syntax section, you can use an apostrophe (') instead of the Rem keyword. If the Rem keyword follows other statements on a line, it must be separated from the statements by a colon. However, when you use an apostrophe, the colon is not required after other statements.


Select Case

Executes one of several groups of statements, depending on the value of an expression.

Syntax

Select Case testexpression
[Case expressionlist-n
[statements-n]] . . .
[Case Else expressionlist-n
[elsestatements-n]]
End Select

The Select Case statement syntax has these parts:

Part | Description
testexpression | Any numeric or string expression.
expressionlist-n | Required if Case appears. Delimited list of one or more expressions.
statements-n | One or more statements executed if testexpression matches any part of expressionlist-n.
elsestatements | One or more statements executed if testexpression doesn't match any of the Case clauses.

Remarks

If testexpression matches any Case expressionlist expression, the statements following that Case clause are executed up to the next Case clause, or for the last clause, up to End Select. Control then passes to the statement following End Select. If testexpression matches an expressionlist expression in more than one Case clause, only the statements following the first match are executed.

The Case Else clause is used to indicate the elsestatements to be executed if no match is found between the testexpression and an expressionlist in any of the other Case selections. Although not required, it is a good idea to have a Case Else statement in your Select Case block to handle unforeseen testexpression values. If no Case expressionlist matches testexpression and there is no Case Else statement, execution continues at the statement following End Select.

Select Case statements can be nested. Each nested Select Case statement must have a matching End Select statement.


Set

Assigns an object reference to a variable or property.

Syntax

Set objectvar = {objectexpression | Nothing}

The Set statement syntax has these parts:

Part | Description
objectvar | Name of the variable or property; follows standard variable naming conventions.
objectexpression | Expression consisting of the name of an object, another declared variable of the same object type, or a function or method that returns an object of the same object type.
Nothing | Discontinues association of objectvar with any specific object. Assigning objectvar to Nothing releases all the system and memory resources associated with the previously referenced object when no other variable refers to it.

Remarks

To be valid, objectvar must be an object type consistent with the object being assigned to it.

The Dim, Private, Public, or ReDim statements only declare a variable that refers to an object. No actual object is referred to until you use the Set statement to assign a specific object.

Generally, when you use Set to assign an object reference to a variable, no copy of the object is created for that variable. Instead, a reference to the object is created. More than one object variable can refer to the same object. Because these variables are references to (rather than copies of) the object, any change in the object is reflected in all variables that refer to it.


Sub

Declares the name, arguments, and code that form the body of a Sub procedure.

Syntax

[Public | Private] Sub name [(arglist)]
[statements]
[Exit Sub]
[statements]
End Sub

The Sub statement syntax has these parts:

Part | Description
Public | Indicates that the Sub procedure is accessible to all other procedures in all modules.
Private | Indicates that the Sub procedure is accessible only to other procedures in the module where it is declared.
name | Name of the Sub; follows standard variable naming conventions.
arglist | List of variables representing arguments that are passed to the Sub procedure when it is called. Multiple variables are separated by commas.
statements | Any group of statements to be executed within the body of the Sub procedure.

The arglist argument has the following syntax and parts:

[ByVal | ByVal] varname[( )]

Part | Description
ByVal | Indicates that the argument is passed by value.
Byref | Indicates that the argument is passed by reference.
varname | Name of the variable representing the argument; follows standard variable naming conventions.

Remarks

If not explicitly specified using either Public or Private, Sub procedures are public by default, that is, they are visible to all other procedures in your module. The value of local variables in a Sub procedure is not preserved between calls to the procedure.

All executable code must be contained in procedures. You can't define a Sub procedure inside another Sub or Function procedure.

The Exit Sub statement causes an immediate exit from a Sub procedure. Program execution continues with the statement following the statement that called the Sub procedure. Any number of Exit Sub statements can appear anywhere in a Sub procedure.

Like a Function procedure, a Sub procedure is a separate procedure that can take arguments, perform a series of statements, and change the value of its arguments. However, unlike a Function procedure, which returns a value, a Sub procedure can't be used in an expression.

You call a Sub procedure using the procedure name followed by the argument list. See the Call statement for specific information on how to call Sub procedures.

Sub procedures can be recursive; that is, they can call themselves to perform a given task. However, recursion can lead to stack overflow.

Variables used in Sub procedures fall into two categories: those that are explicitly declared within the procedure and those that are not. Variables that are explicitly declared in a procedure (using Dim or the equivalent) are always local to the procedure. Variables that are used but not explicitly declared in a procedure are also local unless they are explicitly declared at some higher level outside the procedure.

A procedure can use a variable that is not explicitly declared in the procedure, but a naming conflict can occur if anything you have defined at the module level has the same name. If your procedure refers to an undeclared variable that has the same name as another procedure, constant or variable, it is assumed that your procedure is referring to that module-level name. Explicitly declare variables to avoid this kind of conflict. You can use an Option Explicit statement to force explicit declaration of variables.


While...Wend

Executes a series of statements as long as a given condition is True.

Syntax

While condition
[statements]
Wend

The While...Wend statement syntax has these parts:

Part | Description
condition | Numeric or string expression that evaluates to True or False. If condition is Null, condition is treated as False.
statement | One or more statements executed while condition is True.

Remarks

If condition is True, all statements in statements are executed until the Wend statement is encountered. Control then returns to the While statement and condition is again checked. If condition is still True, the process is repeated. If it is not True, execution resumes with the statement following the Wend statement.

While...Wend loops can be nested to any level. Each Wend matches the most recent While.

The Do...Loop statement provides a more structured and flexible way to perform looping.


Operators

Operators

Operator Precedence

Addition (+)

And

Concatenation (&)

Division (/)

Eqv

Exponentiation (^)

Imp

Integer Division (\)

Is

Mod

Multiplication (*)

Negation (-)

Not

Or

Subtraction (-)

Xor


Operator Precedence

When several operations occur in an expression, each part is evaluated and resolved in a predetermined order called operator precedence. Parentheses can be used to override the order of precedence and force some parts of an expression to be evaluated before other parts. Operations within parentheses are always performed before those outside. Within parentheses, however, normal operator precedence is maintained.

When expressions contain operators from more than one category, arithmetic operators are evaluated first, comparison operators are evaluated next, and logical operators are evaluated last. Comparison operators all have equal precedence; that is, they are evaluated in the left-to-right order in which they appear. Arithmetic and logical operators are evaluated in the following order of precedence:

Arithmetic | Comparisons | Logical
Expotentiation (^) | Equality (=) | Not
Negation (-) | Inequality (<>) | And
Multiplication and Division (*, /) | Less than (<) | Or
Integer Division (\) | Greater than (>) | Xor
Modulus Arithmetic (Mod) | Less than or equal to (<=) | Eqv
Addition and Subtraction (+, -) | Greater than or equal to (>=) | Imp
String Concatination (&) | Is | &

When multiplication and division occur together in an expression, each operation is evaluated as it occurs from left to right. Likewise, when addition and subtraction occur together in an expression, each operation is evaluated in order of appearance from left to right.

The string concatenation operator (&) is not an arithmetic operator, but in precedence it does fall after all arithmetic operators and before all comparison operators. The Is operator is an object reference comparison operator. It does not compare objects or their values; it checks only to determine if two object references refer to the same object.

Version Information

The following table lists the version of Microsoft Visual Basic for Windows CE Run-Time Edition implemented by host applications.

Host | Visual Basic for Windows CE Run Time 1.0 | Visual Basic for Windows CE Run Time 2.0
Microsoft Internet Explorer 3.0 | X |
Microsoft Internet Information Server 2.0 |  | X


Addition (+)

Used to sum two numbers.

Syntax

result = expression1 + expression2

The + operator syntax has these parts:

Part | Description
result | Any numeric variable.
expression1 | Any expression.
expression2 | Any expression.

Remarks

Although you can also use the + operator to concatenate two character strings, you should use the & operator for concatenation to eliminate ambiguity and provide self-documenting code.

When you use the + operator, you may not be able to determine whether addition or string concatenation will occur.

The underlying subtype of the expressions determines the behavior of the + operator in the following way:

If | Then
Both expressions are numeric | Add.
Both expressions are strings | Concatenate.
One expression is numeric and the other is a string | Add.

If one or both expressions are Null expressions, result is Null. If both expressions are Empty, result is an Integer subtype. However, if only one expression is Empty, the other expression is returned unchanged as result.


And

Used to perform a logical conjunction on two expressions.

Syntax

result = expression1 And expression2

The And operator syntax has these parts:

Part | Description
result | Any numeric value.
expression1 | Any expression.
expression2 | Any expression.

Remarks

If, and only if, both expressions evaluate to True, result is True. If either expression evaluates to False, result is False. The following table illustrates how result is determined:

If expression1 is | And expression2 is | The result is
True | True | True
True | False | False
True | Null | Null
False | True | False
False | False | False
False | Null | False
Null | True | Null
Null | False | False
Null | Null | Null

The And operator also performs a bitwise comparison and sets the corresponding bit in result according to the following table:

If the bit in expression1 is | And the bit in expression2 is | The result is
0 | 0 | 0
0 | 1 | 0
1 | 0 | 0
1 | 1 | 1


Concatenation (&)

Used to force string concatenation of two expressions.

Syntax

result = expression1 & expression2

The & operator syntax has these parts:

Part | Description
result | Any numeric value.
expression1 | Any expression.
expression2 | Any expression.

Remarks

Whenever an expression is not a string, it is converted to a String subtype. If both expressions are Null, result is also Null. However, if only one expression is Null, that expression is treated as a zero-length string ("") when concatenated with the other expression. Any expression that is Empty is also treated as a zero-length string.


Division (/)

Used to divide two numbers and return a floating-point result.

Syntax

result = number1/number2

The / operator syntax has these parts:

Part | Description
result | Any numeric value.
expression1 | Any expression.
expression2 | Any expression.

Remarks

If one or both expressions are Null expressions, result is Null. Any expression that is Empty is treated as 0.


Eqv

Used to perform a logical equivalence on two expressions.

Syntax

result = expression1 Eqv expression2

The Eqv operator syntax has these parts:

Part | Description
result | Any numeric value.
expression1 | Any expression.
expression2 | Any expression.

Remarks

If either expression is Null, result is also Null. When neither expression is Null, result is determined according to the following table:

If expression1 is | And expression2 is | The result is
True | True | True
True | False | False
False | True | False
False | False | True

The Eqv operator performs a bitwise comparison of identically positioned bits in two numeric expressions and sets the corresponding bit in result according to the following table:

If the bit in expression1 is | And the bit in expression2 is | The result is
0 | 0 | 1
0 | 1 | 0
1 | 0 | 0
1 | 1 | 1


Exponentiation (^)

Used to raise a number to the power of an exponent.

Syntax

result = number^exponent

The ^ operator syntax has these parts:

Part | Description
result | Any numeric variable.
number | Any numeric expression.
exponent | Any numeric expression.

Remarks

Number can be negative only if exponent is an integer value. When more than one exponentiation is performed in a single expression, the ^ operator is evaluated as it is encountered from left to right.

If either number or exponent is a Null expression, result is also Null.


Imp

Used to perform a logical implication on two expressions.

Syntax

result = expression1 Imp expression2

The Imp operator syntax has these parts:

Part | Description
result | Any numeric value.
expression1 | Any expression.
expression2 | Any expression.

Remarks

The following table illustrates how result is determined:

If expression1 is | And expression2 is | The result is
True | True | True
True | False | False
True | Null | Null
False | True | True
False | False | True
False | Null | True
Null | True | True
Null | False | Null
Null | Null | Null

The Imp operator performs a bitwise comparison of identically positioned bits in two numeric expressions and sets the corresponding bit in result according to the following table:

If the bit in expression1 is | And the bit in expression2 is | The result is
0 | 0 | 1
0 | 1 | 1
1 | 0 | 0
1 | 1 | 1


Integer Division (\)

Used to divide two numbers and return an integer result.

Syntax

result = number1\number2

The \ operator syntax has these parts:

Part | Description
result | Any numeric variable.
number1 | Any numeric expression.
number2 | Any numeric expression.

Remarks

Before division is performed, numeric expressions are rounded to Byte, Integer, or Long subtype expressions.

If any expression is Null, result is also Null. Any expression that is Empty is treated as 0.


Is

Used to compare two object reference variables.

Syntax

result = object1 Is object2

The Is operator syntax has these parts:

Part | Description
result | Any numeric variable..
object1 | Any object name.
object2 | Any object name.

Remarks

If object1 and object2 both refer to the same object, result is True; if they do not, result is False. Two variables can be made to refer to the same object in several ways.

In the following example, A has been set to refer to the same object as B:

Set A = B

The following example makes A and B refer to the same object as C:

Set A = C
Set B = C


Mod

Used to divide two numbers and return only the remainder.

Syntax

result = number1 Mod number2

The Mod operator syntax has these parts:

Part | Description
result | Any numeric variable.
number1 | Any numeric expression.
number2 | Any numeric expression.

Remarks

The modulus, or remainder, operator divides number1 by number2 (rounding floating-point numbers to integers) and returns only the remainder as result. For example, in the following expression, A (which is result) equals 5.

A = 19 Mod 6.7

If any expression is Null, result is also Null. Any expression that is Empty is treated as 0.


Multiplication (*)

Used to multiply two numbers.

Syntax

result = number1*number2

The * operator syntax has these parts:

Part | Description
result | Any numeric variable.
number1 | Any numeric expression.
number2 | Any numeric expression.

Remarks

If one or both expressions are Null expressions, result is Null. If an expression is Empty, it is treated as if it were 0.


Negation (-)

Used to find the difference between two numbers or to indicate the negative value of a numeric expression.

Syntax 1

result = number1-number2

Syntax 2

-number

The - operator syntax has these parts:

Part | Description
result | Any numeric variable.
number | Any numeric expression.
number1 | Any numeric expression.
number2 | Any numeric expression.

Remarks

In Syntax 1, the - operator is the arithmetic subtraction operator used to find the difference between two numbers. In Syntax 2, the - operator is used as the unary negation operator to indicate the negative value of an expression.

If one or both expressions are Null expressions, result is Null. If an expression is Empty, it is treated as if it were 0.


Not

Used to perform logical negation on an expression.

Syntax

result = Not expression

The Not operator syntax has these parts:

Part | Description
result | Any numeric variable.
expression | Any expression.

Remarks

The following table illustrates how result is determined:

If expression is | The result is
True | False
False | True
Null | Null

In addition, the Not operator inverts the bit values of any variable and sets the corresponding bit in result according to the following table:

Bit in expression | Bit in result
0 | 1
1 | 0


Or

Used to perform a logical disjunction on two expressions.

Syntax

result = expression1 Or expression2

The Or operator syntax has these parts:

Part | Description
result | Any numeric variable.
expression1 | Any expression.
expression2 | Any expression.

Remarks

If either or both expressions evaluate to True, result is True. The following table illustrates how result is determined:

If expression1 is | And expression2 is | The result is
True | True | True
True | False | True
True | Null | True
False | True | True
False | False | False
False | Null | Null
Null | True | True
Null | False | Null
Null | Null | Null

The Or operator also performs a bitwise comparisonof identically positioned bits in two numeric expressions and sets the corresponding bit in result according to the following table:

If the bit in expression1 is | And the bit in expression2 is | The result is
0 | 0 | 0
0 | 1 | 1
1 | 0 | 1
1 | 1 | 1


Subtraction (-)

Used to find the difference between two numbers or to indicate the negative value of a numeric expression.

Syntax 1

result = number1-number2

Syntax 2

-number

The - operator syntax has these parts:

Part | Description
result | Any numeric variable.
number | Any numeric expression.
number1 | Any numeric expression.
number2 | Any numeric expression.

Remarks

In Syntax 1, the - operator is the arithmetic subtraction operator used to find the difference between two numbers. In Syntax 2, the - operator is used as the unary negation operator to indicate the negative value of an expression.

If one or both expressions are Null expressions, result is Null. If an expression is Empty, it is treated as if it were 0.


Xor

Used to perform a logical exclusion on two expressions.

Syntax

result = expression1 Xor expression2

The Xor operator syntax has these parts:

Part | Description
result | Any numeric variable.
expression1 | Any expression.
expression2 | Any expression.

Remarks

If one, and only one, of the expressions evaluates to True, result is True. However, if either expression is Null, result is also Null. When neither expression is Null, result is determined according to the following table:

If expression1 is | And expression2 is | The result is
True | True | False
True | False | True
False | True | True
False | False | False

The Xor operator also performs a bitwise comparison of identically positioned bits in two numeric expressions and sets the corresponding bit in result according to the following table:

If the bit in expression1 is | And the bit in expression2 is | The result is
0 | 0 | 0
0 | 1 | 1
1 | 0 | 1
1 | 1 | 0


Microsoft Technical Support

Your Guide to Microsoft Technical Support

You can find late-breaking updates and technical information in the readme file that came with your product disks or compact disc.

If you still have a question, Microsoft offers technical support and services ranging from self-help tools to direct assistance with a Microsoft technical engineer.

Note The services and prices listed here are available in the United States and Canada only. Support services may vary outside the U.S. and Canada. For more information on support in other locations, contact your local Microsoft subsidiary.

Microsoft's support services are subject to Microsoft's then-current prices, terms, and conditions, which are subject to change without notice.

Choose the support option that's right for you:

  • Self Help Tools
  • Direct Assistance with a Microsoft Technical Support Engineer
  • Other Microsoft Services
  • Microsoft Technical Support Worldwide


Self-Help Tools

Support Online at http://support.microsoft.com/support

Do you prefer to help yourself to answers? Support Online makes it easy. Simply select your product and type in your question. Because the site's search engine uses a natural language query, you can even write your question in your own words. Then click "Find" and Support Online does all the rest, employing the latest Microsoft technologies to instantly search Microsoft Technical Support's vast collection of problem-solving tools and technical information like the Knowledge Base and Frequently Asked Questions. Next time you have a technical question, use Support Online and see how easy it is to get the answers you need.


Other Self-Help Tools

In addition to the Internet resources, Microsoft Technical Support provides the following additional technical information resources:

  • Microsoft TechNet

    If you are an information technology (IT) or Help desk professional responsible for administering your corporate network or supporting end users then you can stay on top of your organization's requirements with TechNet. TechNet is a comprehensive resource for evaluating, implementing, and supporting Microsoft business products. Every month, TechNet delivers two CDs packed with more than 150,000 pages of the critical information you need to smoothly deploy mission-critical systems and minimize downtime–all while building your technical expertise. To subscribe, see your local authorized retailer, or call (800) 344-2121, Monday through Friday, excluding holidays, 6:30 A.M to 5:30 P.M. Pacific time.

  • Microsoft Developer Network Library (MSDN)

    If you develop applications for the Internet or the Windows® operating system, or use Microsoft products for any other development purposes, you'll enhance your productivity with an MSDN subscription. MSDN is Microsoft's official source for technical programming information, SDKs, DDKs, Windows, BackOffice™, Microsoft Office, and Visual Tools for developers. For more information on MSDN subscription levels and benefits, visit MSDN online at: http://www.microsoft.com/msdn/. Or call (800) 759-5474, Monday through Friday, excluding holidays, 6:30 A.M. to 5:30 P.M. Pacific time.

  • Microsoft Download Service (MSDL)

    Provides direct modem access to Microsoft's electronic technical library, which contains sample programs, device drivers, patches, software updates, and programming aids. The service is available 24 hours a day, 365 days a year. In the U.S. dial (425) 936-6735. Connect information: 1200, 2400, 9600, or 14400 baud, no parity, 8 data bits, and 1 stop bit. In Canada, dial (905) 507-3022. Connect information: 1200 to 28800 baud, no parity, 8 data bits, and 1 stop bit.

  • Microsoft FastTips

    An automated toll-free telephone service for quick answers to common technical questions, as well as technical articles by telephone, fax, or mail. To access FastTips or to receive a catalog of the articles available, call one of the following numbers on a touch-tone telephone:

  • Desktop Applications
    1. 936-4100
  • Desktop Systems
    1. 936-4200
  • Development Tools
    1. 936-4300
  • Business Systems
    1. 936-4400

You can use the following keys on your touch-tone telephone after you reach FastTips.

To Do This: | Press This Key:
Advance to the next message | *
Repeat the current message | 7
Return to the beginning of FastTips | #


Direct Assistance with a Microsoft Technical Support Engineer

Your options for direct assistance are:

  • Standard No-Charge Support
  • Pay-Per-Incident Support
  • Priority Annual Support
  • Priority Plus
  • Premier Support
  • Consult Line


Standard No-Charge Support

If you still need answers to your technical questions, Microsoft offers no-charge support for retail* versions of Microsoft® Windows CE Toolkit for Visual Basic 5.0 as follows:

Two (2) no-charge support incidents for current retail versions of this product.

To receive your Standard No-Charge Support, in the U.S., please call (425) 635-3115, 6 A.M. to 6 P.M. Pacific time, Monday through Friday, excluding holidays. In Canada, please call (905) 568-3503, 8:00 A.M. to 8:00 P.M.. Eastern time, Monday through Friday, excluding holidays. Note: Toll charges may apply.

In the U.S. and Canada, you can also submit your support question via the Internet with Web Response. For more details, go to Support Online at http://support.microsoft.com/support.

Note If your Microsoft product was pre-installed or distributed with your personal computer, the personal computer manufacturer is responsible for providing your product support. For support, contact the manufacturer or source from which you obtained your Microsoft product.

When you contact us for support, you should be at your computer and have the appropriate product documentation at hand. Be prepared to give the following information:

  • The version of the Microsoft product you use.
  • The type of hardware you use.
  • The operating system you use.
  • The exact wording of any messages that appeared on your screen.
  • A description of what happened and what you were doing when the problem occurred.
  • A description of how you tried to solve the problem.


Pay-Per-Incident Support

If you require support after normal business hours, or if you have used your two Standard No-Charge support incidents, as described above, you can purchase Pay-Per-Incident Support Microsoft® Windows CE Toolkit for Visual Basic 5.0 as follows:

  • In the U.S. and Canada, for a fee of $95US per incident, please call (800) 936-5800, 24 hours a day, seven days a week, including holidays.
  • In the U.S. only, you can also call (900) 555-2300, 24 hours a day, seven days a week, including holidays.
  • In the U.S. and Canada, you can also submit your support question via the Internet with Web Response. For more details, go to Support Online at http://support.microsoft.com/support.

Note Support fees for the (800)# calls will be billed to your VISA, MasterCard, or American Express credit card. Support fees for the (900)# calls will appear on your telephone bill.


Priority Annual Support

If you anticipate a higher volume of support incidents, or need priority access to Microsoft Technical Support Engineers, you can purchase a Priority Annual Developer Account as follows:

  • In the U.S., for more information or to purchase an annual account at a cost of $895 US per 10 incidents, please call (800) 936-3500, 24 hours a day, seven days a week, including holidays. To submit an incident against an existing account, call (800) 936-4800, 24 hours a day, seven days a week, including holidays.
  • In Canada, for more information, to purchase an annual account at a cost of $895 CDN plus tax per 10 incidents, or to submit an incident against an existing account, please call (800) 668-7975, Monday through Friday, excluding holidays, 8:00 A.M. to 8:00 P.M. Eastern time.


Priority Plus

Microsoft Technical Support also offers special accounts for medium-sized businesses that require priority incident resolution, including business-critical support and access to targeted information to assist information-technology and Help desk professionals in support planning for smoother product deployment. For more information, in the U.S. and Canada, please call (800) 936-3500, 24 hours a day, seven days a week, including holidays.


Premier Support

Premier Support offers the highest level of mission-critical support for those large enterprise customers who require a direct, proactive service and support relationship with Microsoft. As a Premier customers receive proactive, personalized support services and fast, expert resolution of specific technical issues for all Microsoft products, anytime, day or night. Premier Support is designed to help you successfully develop, deploy, and manage critical business systems built around high-quality Microsoft solutions. This highest level of mission-critical support, combined with a close relationship with your own designated technical team, will help large enterprise businesses streamline the entire support cycle. For more information or to purchase Premier Support, call (800) 936-3200, Monday through Friday, excluding holidays, 5:00 A.M. to 5:00 P.M. Pacific time.


Consult Line

Take advantage of our Consult Line to receive hourly consulting for support questions that fall outside of the traditional technical support realm. These include designing or planning for deployment, software development, code review, and implementation planning. The Consult Line covers all Microsoft products, including those Microsoft products used for developing Internet and intranet solutions. For more information or to purchase hourly consulting services at $195 US per hour (minimum one hour), please call (800) 936-5200, Monday through Friday, excluding holidays, 6:00 A.M. to 6:00 P.M. Pacific time.


Additional Assistance from Microsoft Support Partners

As Microsoft products are integrated into multi-vendor environments, our customers' support needs go beyond Microsoft products to include hardware, networking, and software products from other vendors. For these and other specialized support requirements, Microsoft offers a variety of programs that provide comprehensive worldwide service and support. In fact, you may already have an established relationship with an experienced Microsoft support provider. If not, check out these resources.


Microsoft Certified Solution Providers

Microsoft creates the technology, while Microsoft Certified Solution Providers (MCSPs) develop the actual solutions for customers all over the world. MCSPs are, in fact, Microsoft's virtual service and support team. From small organizations to companies of 1,000 or more employees, MCSPs use Microsoft products as the building blocks to offer such value-added services as integration, consulting, software customization, application development, and technical training and support. MCSPs have Microsoft Certified Professionals on staff and often specialize in an industry or a specific solution. Therefore, they are the most knowledgeable on those applications and can offer expert, comprehensive support. And in most cases, they can bring their expertise right on-site, offering you all the benefits of a local support presence. For more information or for a referral, call (800) 765-7768, Monday through Friday, excluding holidays, 6:30 A.M. to 5:30 P.M. Pacific time, or visit the http://www.microsoft.com/mcsp/ site.


Other Microsoft Services

Includes information on customer service and text telephone numbers for the deaf.

  • Text telephone

    Microsoft text telephone (TTY/TDD) services are available for the deaf or hard-of-hearing. In the U.S., using a TTY/TDD modem, dial (425) 635-4948 between 6:00 A.M. and 6:00 P.M. Pacific time, Monday through Friday, excluding holidays. In Canada, using a TTY/TDD modem, dial (905) 568-9641 between 8:00 A.M. and 8:00 P.M. eastern time, Monday through Friday, excluding holidays.

  • Microsoft Customer Service

    For customer service issues on Microsoft products, upgrades, and services, contact the Microsoft Sales Information Center. In the U.S., call (800) 426-9400. In Canada, call (800) 563-9048. Note: Technical support is not available at these numbers.


Microsoft Technical Support Worldwide

If you are outside the U.S. and have a question about a Microsoft product, first:

  • Check the information in this Help file or product manual.
  • Check the readme files that come with your product disks. These files provide general information that became available shortly before the product was released.
  • Go to Support Online at http://support.microsoft.com/support.

If you cannot find a solution, you can receive information on how to obtain product support by contacting the Microsoft subsidiary office in your area.


Contacting a Microsoft Subsidiary Office

When you call your local Microsoft subsidiary, you should be at your computer and have the appropriate product documentation at hand. Be prepared to provide the following information:

  • The version of the Microsoft product you use.
  • The type of hardware you use, including network hardware, if applicable.
  • The operating system you use.
  • The exact wording of any messages that appeared on your screen.
  • A description of what happened and what you were doing when the problem occurred.
  • A description of how you tried to solve the problem.

Important Phone numbers for Microsoft Subsidiaries are subject to change. For the most recent listing, please see the phone number section of http://www.microsoft.com/support/. If there is no Microsoft subsidiary office in your country, please contact the establishment from which you obtained your Microsoft product.


Microsoft Worldwide Subsidiaries

  • Argentina

    Microsoft de Argentina S.A.
    Customer Service: (54) (1) 316-4600
    Fax: (54) (1) 316-4698
    Technical Support: (54) (1) 316-4664

  • Armenia

    See Russia

  • Australia

    Microsoft Pty. Ltd.
    Fax: (61) (02)9805 1108
    Sales Information Centre: (61) (02) 9870-2100
    Internet://www.microsoft.com.au/
    Technical Support: (61) (02) 9870-2131

  • Austria

    Microsoft Ges.m.b.H.
    Phone: (+43) 1 610 64 -0
    Fax: (+43) 1 610 64 -200
    Information: 0660-6520
    Prices, updates, etc.: 0660-6520
    Standard Support:
    Installation and Handling: 01 50222-2255
    General information about Support Network in Central Europe:
    FAX: 01805-251191

  • Azerbaijan

    See Russia

  • Belgium

    Microsoft NV
    Phone: +32-2-730 39 11
    Fax: +32-2-726 96 09
    Microsoft Information Center: +32-2-481 52 52
    Bulletin Board: +32-2-726 85 45 (14400/1200/2400/9600 bd, 8N1, ANSI)
    Technical Support:
    +32-2-513 32 74 (Dutch speaking)
    +32-2-502 34 32 (English speaking)
    +32-2-513 22 68 (French speaking)

  • Belorussia

    See Russia

  • Bolivia

    See Argentina

  • Brazil

    Microsoft Informatica Ltda.
    Phone: (55) (11) 5514 –7100
    Fax: (55) (11) 5514 - 7106/5514-7107
    Technical Support:
    Phone: (55) (11) 5506-8087
    Fax: (55) (11) 5506-7621
    Automatic Fax: (55) (11) 5506-8506
    Technical Support Bulletin Board Service: (55) (11) 5506-1234
    Customer Support: (55) (11) 822-5764

  • Canada

    Microsoft Canada Inc.
    Head Office Phone: 1 (905) 568-0434
    Customer Information Centre: 1 (800) 563-9048
    Technical Support:
    Desktop Systems including Microsoft Windows 95: (905) 568-4494
    Microsoft Office and Office Components: (905) 568-2294
    Other Standard Technical Support: (905) 568-3503
    Priority Support Information: (800) 668-7975
    Text Telephone (TTY/TDD) (905) 568-9641
    Technical Support Bulletin Board Service: (905) 507-3022

  • Caribbean

    Microsoft Caribbean, Inc.
    Phone: (809) 273-3600
    Fax: (809) 273-3636
    Technical Support: (214) 714-9100

  • Central America

    See Latin America

  • Chile

    Microsoft Chile S.A.
    Phone: 56-2-330-6000
    Fax: 56-2-330-6190
    Customer Service: 56-2-800-213121
    Personal Operating System and Applications:
    Phone: 56-2-330-6222
    Fax: 56-2-341-1439

  • China

    Microsoft (China) Co. Ltd
    4/F Kai Yuen Commercial Building
    No.28 Zhichunli, Hai Dian District
    Beijing 100086, PRC
    Phone: 011-86-10-6261-7711
    Fax: 011-86-10-6253-6630

  • Colombia

    Microsoft Colombia
    Phone: (571) 618 2245
    Fax: (571) 618 2269
    Technical Support:
    Línea de Respuesta Microsoft
    Phone: (571) 5230022
    Fax: (571) 5231220
    Voice Mail: (571) 5034216

  • Croatia

    Microsoft Hrvatska d.o.o.
    Phone: (+385) (1) 304 555
    Fax: (+385) (1) 335 051
    Technical Support:
    (Please contact the subsidiary.)

  • Czech Republic

    Microsoft s.r.o.
    Phone (+42) (2) 611 97 111
    Fax: (+42) (2) 611 97 100
    Technical Support:
    (+420) (2) 2150 3222

  • Denmark

    Microsoft Denmark
    Phone: (45) 44 89 01 00
    Fax: (45) 44 68 55 10
    Technical Support:
    Phone: (45) 44 89 01 11
    Microsoft Sales Support: (45) 44 89 01 90
    Microsoft FastTips: (45) 44 89 01 44
    (Document 303030 in FastTips contains detailed instructions)
    Microsoft MSDL (BBS): (45) 44 66 90 46

  • Dominican Republic

    See Central America

  • Dubai

    Microsoft Middle East
    Phone: (971) 4 513 888
    Fax: (971) 4 527 444
    Technical Support:
    Personal Operating Systems & Desktop Applications ONLY:
    Phone: (971) (4) 524 488
    Fax: (971)- 4 – 524 495
    email: mts@emirates.net.ae
    Priority Support Information: (971) (4) 555 752

    Customer Service Center:
    (Version upgrade / TechNet and MSDN subscription)
    Phone: (971) (4) 655 082
    Fax: (971) (4) 655 097

  • Ecuador

    Corporation Microsoft del Ecuador S.A.
    Phone: (593) 2 460-447, (593) (2) 460-451
    Customer Service: (593) (2) 460-453, (593) (2) 460-458
    Technical Support: (593) (2) 463-094

  • Egypt

    Microsoft Egypt
    Phone: +202-418-6101
    Fax: +202-4174766
    Technical Support:
    Personal Operating Systems and Desktop Applications ONLY:
    Phone: (202) 261 3991 / 6
    Fax: (971) 403 2718

  • England

    See United Kingdom

  • Estonia

    See Germany

  • Finland

    Microsoft OY
    Phone: +358-(0)9-525 501
    Fax: +358-(0)9-878 8770
    Technical Support:
    Phone: +358-(0)9-525 502 500
    Sales Support: +358-(0)9-525 5026
    Microsoft MSDL: +358-(0)9-878 77 99
    (Information in Swedish and English)
    Microsoft FastTips: +358-(0)9-525 502 550
    (Information in Swedish and English)

  • France

    Microsoft France
    Phone: (33) 01 69-86-46-46
    Fax: (33) 01 64-46-06-60
    Telex: MSPARIS 604322
    Technical Support Phone: (33) 01-69-86-10-20
    Technical Support Fax: (33) (01) 69-28-00-28

  • French Polynesia

    See France

  • Georgia

    See Russia

  • Germany

    Microsoft GmbH
    Phone: 089/3176-0
    Fax: 089/3176-1000
    Telex: (17) 89/83 28 MS GMBH D
    Information: 089/3176 1199
    Prices, updates, etc.: 08105-25-1199
    Internet: www.microsoft.com/germany
    Standard Support: Installation and Handling: 01805/67 22 55
    General information about Microsoft support in Central Europe:
    Fax: 1805-25-1191

  • Greece

    Microsoft Hellas, S.A.
    Phone: (30)(1) 6806-775 through (30)(1) 6806-779
    Fax: (30)(1) 6806-780
    Technical Support
    Phone: (30) (1) 9247-030
    Fax: (30) (1) 9215-363

  • Hong Kong

    Microsoft Hong Kong Limited
    Fax: (852)2560-2217
    Product support Faxback Service: (852)2535-9293
    Microsoft Club Hotline: (852)28044277
    Technical Support: (852) 2804-4222

  • Hungary

    Microsoft Hungary
    Phone: +36 (1) 327-2800
    Fax: +36 (1) 327-2899
    Technical Support: +36 (1) 267-4636 (2MSINFO)

  • Iceland

    See Denmark

  • Ireland

    See United Kingdom

  • India

    Microsoft India
    Phone: (011) (91) (80) 5092678, (011) (91) (11) 646 0767, 646 0813
    Fax: (011) (91) (80) 509-2601, (011) (91) (11) 647- 4714

  • Indonesia (SP)

    Microsoft Indonesia - Jakarta
    Technical Support
    Phone: 62 21 5721060
    Fax: 62 21 5732077

  • Israel

    Microsoft Israel Ltd.
    Phone: 972-3-613-0833
    Fax: 972-3-613-0834

  • Italy

    Microsoft SpA
    Phone: (39) (2) 7039-21
    Fax: (39) (2) 7039-2020
    Microsoft Rome Office: (39) (6) 5095-01 - Fax: (39) (6) 5095-0600
    Microsoft by Fax (Fax-on-demand service):
    (39) (2) 70-398-888
    Customer Service (New product info, product literature):
    (39) (2) 70-398-398
    Dealer Support (Customer Service for resellers only):
    (39) (2) 70-398-388
    Technical Support: (39) (2) 70-398-398
    Microsoft Consulting Service: (39) (2) 7039-21

  • Japan

    Microsoft Company Ltd.
    Technical Support (Standard Support): (81) (424) 41-8700
    (Technical Support options/ Support Contract)
    Phone: 0120-37-0196 (toll free domestic only)
    Channel Marketing Information Center:
    (Presales Product Support)
    Tokyo Phone: (81) (3) 5454-2300
    Osaka Phone: (81) (6) 245-6995
    Customer Service Phone :
    (Version upgrade/Registration)
    Phone: (81) (48) 226-5500
    Fax: (81) (48) 226-5511

  • Kazakhstan

    See Russia

  • Kirgizia

    See Russia

  • Korea

    Microsoft CH
    Phone: (82) (2) 531-4500
    Fax: (82) (2) 531-1724
    Customer Service: 080-022-7337 (toll free domestic only)
    Technical Support
    Office Technical Support: (82) (2) 508-0040
    Windows Technical Support: (82) (2) 563-0054
    Developer Technical Support: (82) (2) 566-0071
    Microsoft FastTips: (82) (2) 3453-7555
    Support Sales: (82) (2) 531-4544

  • Latin America

    Microsoft
    Latin American Headquarters (U.S.A.)
    Phone: (305) 489-4800
    Fax: (305) 491-1616
    Customer Service: (425) 936-8661
    Technical Support: (214) 714-9100
    http://www.microsoft.com/latam/soporte

  • Liechtenstein

    See Switzerland (German speaking)

  • Luxembourg

    Microsoft NV
    Phone: +32-2-730 39 11
    Microsoft Information Center: +32-2-481 52 52
    Bulletin Board: +32-2-726 85 45
    (1200/2400/9600/14400 bd, 8N1, ANSI)
    Technical Support:
    +32-2-513 32 74 (Dutch speaking)
    +32-2-502 34 32 (English speaking)
    +32-2-513 22 68 (French speaking)

  • Malaysia (SP)

    Microsoft (Malaysia) Sdn Bhd:
    Phone: (60-3) 793-9595
    Fax: (60-3) 791-6080

  • México

    Microsoft México, S.A. de C.V.
    (52) (5) 267-2110 Atencion a Distribuidores (Rese
    (52) (5) 265-3380 Atencion a Clientes
    (52) (5) 265-3399 Soporte Sistemas Operativos y Applicaciones de Escritorio
    (52) (5) 267-2190 Soporte de Sitemas Avanzados y Herramientas de Desarrollo

    Fast Tips: (52) (5) 237-4894

  • Morocco

    Microsoft Afrique Du Nord
    Phone: (212) 2 47 10 72
    Fax: (212) 2 47 10 86

  • Netherlands

    Microsoft BV
    Phone: 023-5689189
    Customer Service: 023-5677700
    Bulletin Board: 023-5634221
    (1200/2400/9600/14400bd, 8N1, ANSI)
    Technical Support:
    023-5677877 (Dutch speaking)
    023-5677853 (English speaking)

  • New Zealand

    Microsoft New Zealand Ltd
    Phone: 64 (9) 357-5800
    Fax: 64 (9) 358-3726
    Technical Support:
    Phone: 64 (9) 357-5575
    Fax: 64 (9) 307-0516 and 357-5577

  • Northern Ireland

    See United Kingdom

  • Norway

    Microsoft Norway AS
    Phone: +(47) 22 02 25 00
    Fax: +(47) 22 95 06 64
    Technical Support: +(47) 22 02 25 50
    Microsoft Sales Support: +(47) 22 02 25 80
    Microsoft MSDL: +(47) 22 18 22 09
    Microsoft FastTips: +(47) 22 02 25 70
    (Document 404040 in FastTips contains detailed instructions)

  • Papua New Guinea

    See Australia

  • Paraguay

    See Argentina

  • Peru

    See Latin America

    Philippines (SP)
    Microsoft Philippines
    Phone: 632 811 0062
    Technical Support:
    Phone: 632 892 2295/2495
    Fax: 632 813 2493

  • Poland

    Microsoft Sp. z o.o.
    Phone: +(48-22) 661-54-00
    Fax: +(48-22) 661-54-34
    Information Service: +(48-22) 865-99-33
    Technical Support:
    +(48-22) 865-99-66

  • Portugal

    Microsoft Portugal MSFT, Lda.
    Phone: (351) 1 4409200
    Fax: (351) 1 4412101
    Technical Support:
    Standard Support:
    (351) 1 4409280/1/2/3
    Fax: (351) 1 4411655

  • Republic of Ireland

    See United Kingdom

  • Romania

    Microsoft s.r.l.
    Phone: (+40) (1) 222 90 16
    Fax: (+40) (1) 222 90 12
    Technical Support:
    (+40) (1) 312 09 48

  • Russia

    Microsoft A/O
    Microsoft Information Center: (095)-913-99-88

  • Scotland

    See United Kingdom

  • Saudi Arabia

    Microsoft Saudi Arabia
    Phone: +966-1-488-1165
    Fax: +966-1-488-1576
    Technical Support
    (Personal Operating System and
    Desktop Applications only):
    Phone: 800 124 0500
    (toll free within Saudi Arabia)
    Fax: 966-1-4740576

  • Singapore

    Microsoft Singapore Pte Ltd
    Phone: (65) 337-6088
    Fax: (65) 337-6788
    Customer Services:
    Phone: (65) 433-5488
    Fax: (65) 339-9958
    Product Support Services:
    Phone: (65) 337-9946
    Fax: (65) 337-6700

  • Slovenia/Slovenija

    Microsoft d.o.o.
    Phone: (+386) (61) 1800 8-00
    Fax: (+386) (61) 1800 822
    Technical Support:
    (+386) (61) 185 3449

  • Slovak Republic

    Microsoft Slovakia s.r.o.
    Phone (+421) (7) 37 63 02
    Fax: (+421) (7) 37 66 71
    Technical Support: (+421) (7) 531 20 83

  • South Africa

    Microsoft South Africa
    Phone: (27) 11 445 0000
    Fax: (27) 11 445 0046
    Technical Support:
    (Toll Free): 0 802 11 11 04
    (Toll): (27) 11 445 0000
    Fax: (+27) 11 445-0343

  • South East Africa and Indian Ocean Islands

    See South Africa

  • Spain

    Microsoft Iberica SRL
    Phone: (34) 1-807-9999
    Fax: (34) 1-803-8310
    Technical Support: (34) 1 -3754004
    Customer Service: (34) 1-3754004
    Fax Back telephone: (34) 1-3754004

  • Sweden

    Microsoft AB
    Phone: +46-(0)8-752 56 00
    Fax: +46-(0)8-750 51 58
    Technical Support: +46-(0)8- 752 09 29
    Sales Support: +46-(0)8- 752 56 30
    Microsoft MSDL: +46-(0)8-750 47 42
    Microsoft FastTips: +46-(0)8-752 29 00
    (Document 202020 in FastTips contains detailed instructions)

  • Switzerland

    Microsoft AG
    Phone: 01-839 61 11
    Fax: 01-831 08 69
    Prices, updates, etc.: 01/839 61 11
    Documentation:
    Phone: 155 59 00
    Fax: 064-224294, Microsoft Info-Service, Postfach, 8099 Zürich
    Standard Technical Support: Installation and Handling:
    0848 80 - 2255
    Technical Support (French speaking): 022-738 96 88
    General information about Microsoft Support in Central Europe:
    FAX: 0049/2622/167006

  • Tadzhikistan

    See Russia

  • Taiwan Region

    Microsoft Taiwan Corp.
    Phone: (886) (2) 504-3122
    Fax: (886) (2) 504-3121
    Technical Support: (886) (2) 508-9501

  • Thailand

    Microsoft (Thailand) Limited
    Phone: (662) 266-3300
    Fax: (662) 266-3310
    Product Support:
    Phone: (662) 613-7208 through 11
    Fax: (662) 613-7198

  • Turkey

    Microsoft Turkey
    Phone: 90 (212) 258 59 98
    Fax: 90 (212) 258 59 54
    Support Hotline:
    Phone: 90 (212) 258 96 66
    Fax: 90 (212) 258 95 99
    Bulletin Board Service: 90 (212) 227 93 90

  • Turkmenistan

    See Russia

  • United Kingdom

    Microsoft Limited
    Fax: (0870) 60 20 100
    Phone: (0870) 60 10 100
    Microsoft KeyData:
    (Bulletin Board Service)
    (0870) 50 30 200 (up to 28.8Kbaud, n, 8, 1)
    Microsoft KeyFax:
    (Faxback Information Service)
    (0870) 50 30 100
    Technical Support:
    Desktop Applications, Home Products, Desktop Systems
    and hardware: 0870 50 10 100

    Developer Products: 0870 50 10 200

    Business Systems: 0870 50 10 300

    Customers phoning from Ireland should dial 706 5353 for technical support.

    Minicom Line 0870 50 30 400
    Pre-Sales Information: Microsoft Connection
    (0345) 00 2000

  • Uruguay

    Technical Support: (598) (2) 77-4934

  • Uzbekistan

    See Russia

  • Venezuela

    Corporation MS 90 de Venezuela S.A.
    Other information: (582)265-9922
    Fax: (582)265-0863 / (582)265-2611
    Technical Support: (582)993-6755

  • Wales

    See United Kingdom