Error Messages, Animated Button Control

The following table lists the trappable errors for the Animated Button control.

Error	Message
Number	Explanation

30000	Error loading picture

30001	Invalid hot spot

30002	Invalid CCB file

30003	Current frame is not a metafile

30004	Current frame is not an icon


Error Messages, Communications Control

The following table lists the trappable errors for the Communications control.

Error	Message
Number	Explanation

8000	Operation not valid while the port is opened

8001	Timeout value must be greater than zero

8002	Invalid Port Number

8003	Property available only at run time

8004	Property is read only at runtime

8005	Port already open

8006	The device identifier is invalid or unsupported

8007	The device's baud rate is unsupported

8008	The specified byte size is invalid

8009	The default parameters are in error

8010	The hardware is not available (locked by another device)

8011	The function cannot allocate the queues

8012	The device is not open

8013	The device is already open

8014	Could not enable comm notification

8015	Could not set comm state

8016	Could not set comm event mask

8018	Operation valid only when the port is open

8019	Device busy

8020	Error reading comm device


Error Messages, Graph Control

The following table lists the trappable errors for the Graph control.

Error	Message
Number	Explanation

32000	String value too long

32001	Subscript out of range

32002	Error creating graph image


Error Messages, MAPI Controls

The following table lists the trappable errors for the MAPI controls.

Error	Message
Number	Explanation

32001	User cancelled process

The current action was not completed because the user cancelled the process.

32002	Unspecified failure has occurred

An unspecified error occurred during the current action.  For example, the action was unable to delete or address mail correctly.

32003	Login has failed

There was no default logon, and the user failed to log on correctly.

32004	Disk is full

The disk is full.  The current action could not create a disk file.

32005	Insufficient memory

There is insufficient memory to proceed with the current action.

32006	Access denied

32007	General Failure

This is an unspecified error.

32008	Too many sessions

The user has too many sessions open at once.

32009	Too many files

Too many file attachments are contained in the message.  The mail wasn't sent or read.

32010	Too many recipients

There are too many message recipients specified.  Mail wasn't sent or read.

32011	Attachment not found

The specified attachment wasn't found, and mail wasn't sent.

32012	Failure on opening attachment

The attachment couldn't be located.  Mail wasn't sent.  Verify that the AttachmentPathName property is valid.

32013	Failure attempting to write an attachment

An attachment could not be written to a temporary file.  Check directory permissions.

32014	Unknown recipient

The recipient doesn't appear in the address list.  Mail wasn't sent.

32015	Invalid recipient type

The type of recipient was incorrect.  Valid type values are 1 (primary recipient), 2 (copy recipient), and 3 (blind copy recipient).

32016	No messages

Unable to find the next message.

32017	Invalid message

An invalid message ID was used.  The current action was not completed.

32018	Text is too large

The text in the message was too large to send.  The mail wasn't sent.  Text is limited to 32K.

32019	Invalid session

An invalid session ID was used.  To associate the MAPI messages control with a valid messaging session, set the SessionID property to the MAPI session control's SessionID.

32020	Type not supported

32021	Ambiguous recipient

One or more recipient addresses are invalid.  Make sure the addresses for the RecipAddress property are valid.

32022	Message in use

32023	Network failure

32024	Invalid editfields

The value of the AddressEditFieldCount property is invalid.  Valid values are from 0 to 4.

32025	Invalid Recipients

One or more recipient addresses are invalid.  Make sure the addresses for the RecipAddress property are valid.

32026	Not supported

The current action is not supported by the underlying mail system.

32027	The user has aborted the previous action

32050	Logon failure: valid session ID already exists

The MAPI messages control is already using a valid session ID.

32051	Property is read only when not using Compose Buffer. Set MsgIndex = -1

32052	Action only valid for Compose Buffer. Set MsgIndex = -1

32053	MAPI Failure: valid session ID does not exist

The MAPI messages control does not have a valid session handle from the MAPI session control.

32054	No originator in the Compose Buffer

You cannot see message originator information while in the Compose Buffer (MsgIndex set to 1).

32055	Action not valid for Compose Buffer

The attempted action is not valid in the Compose Buffer (MsgIndex set
to 1).

32056	Cannot perform action, no messages in list

32057	Cannot perform action, no recipients

32058	Cannot perform action, no attachments


Error Messages, Multimedia MCI Control

The following table lists the trappable errors for the Multimedia MCI control.

Error	Message
Number	Explanation

30001	Can't create button

30002	Can't create a timer resource

30003	Can't create string.  Either string too long or out of memory


Error Messages, Outline Control

The following table lists the trappable errors for the Outline control.

Error	Message
Number	Explanation

32000	Outline: Picture format not supported

32001	Bad outline indentation

32002	Outline: Out of memory

32003	Outline: Parent not expanded

32004	Outline: Unknown error


Error Messages, Picture Clip Control

The following table lists the trappable errors for the Picture Clip control.

Error	Message
Number	Explanation

32000	Picture format not supported

You can only load bitmap (.BMP) files into the picture clip control.

32001	Unable to obtain display context

32002	Unable to obtain memory device context

32003	Unable to obtain bitmap

32004	Unable to select bitmap object

32005	Unable to allocate internal picture structure

32006	Bad GraphicCell Index

The index argument for the GraphicCell property is out of range.  This argument must be in the range 0 to (PicClip.Rows * PicClip.Cols) [image] 1.

32007	No GraphicCell picture size specified

32008	Only bitmap GraphicCell pictures allowed

32010	Bad GraphicCell picture clip property request

32012	GetObject() Windows function failure

A call to the Windows function GetObject () failed.

32014	GlobalAlloc() Windows function failure

A call to the Windows function GlobalAlloc () failed.

32015	Clip region boundary error

The ClipHeight and ClipWidth properties specify coordinates which are outside the boundary of the bitmap loaded in the Picture Clip control.

32016	Cell size too small (must be at least 1 by 1 pixel)

32017	Rows property must be greater than zero

32018	Cols property must be greater than zero

32019	StretchX property cannot be negative

32020	StretchY property cannot be negative

32021	No picture assigned


Error Messages, Spin Button Control

The following table lists the trappable errors for the Spin Button control.

Error	Message
Number	Explanation

30000	Negative value invalid for this property

The Delay, BorderThickness, ShadowThickness, and TdThickness properties cannot be set to a negative value.


Error Messages, 3D Controls

The following table lists the trappable errors for these 3D controls: Command Button, Group Push Button, and Panel.  The remaining 3D controls [image] Check Box, Frame, and Option Button [image] have no trappable errors.

3D Command Button Control

Error	Message
Number	Explanation

30000	Only Picture formats '.BMP' & '.ICO' supported

An unsupported graphic type is assigned to the Picture property of the command button.  Only bitmap and icon formats are supported.

30004	Bevel width must be from 0 to 10

The bevel width is set to an invalid value.

3D Group Push Button Control

Error	Message
Number	Explanation

30001	Only Picture format '.BMP' supported

An unsupported graphic type is assigned to the Picture property of the 3D group push button.  Only the bitmap format is supported.

30005	Group number must be from 0 to 99

The GroupNumber property is set to an invalid value.

30007	Bevel width must be from 0 to 2

The bevel width is set to an invalid value.

3D Panel Control

Error	Message
Number	Explanation

30002	Bevel width must be from 0 to 30

The BevelWidth property is set to an invalid value.

30003	Border width must be from 0 to 30

The BorderWidth property is set to an invalid value.

30006	Flood percent must be from 0 to 100

The FloodPercent property is set to an invalid value.


3D Controls Constants

See Also

AlignTo Constants

Constant	Value	Description

ssTextRight	0	Text to right.

ssTextLeft	1	Text to left.

AlignFrameText Constants

Constant	Value	Description

ssLeftJustify	0	Left align text.

ssRightJustify	1	Right align text.

ssCenter	2	Center text.

AlignPanelText Constants

Constant	Value	Description

ssLeftTop	0	Text to left and top.

ssLeftMiddle	1	Text to left and middle.

ssLeftBottom	2	Text to left and bottom.

ssRightTop	3	Text to right and top.

ssRightMiddle	4	Text to right and middle.

ssRightBottom	5	Text to right and bottom.

ssCenterTop	6	Text to center and top.

ssCenterMiddle	7	Text to center and middle.

ssCenterBottom	8	Text to center and bottom.

AutoSizeButton Constants

Constant	Value	Description

ssNone	0	No autosizing.

ssPictureToButton	1	Autosize picture to button.

ssButtonToPicture	2	Autosize button to picture.

AutoSizePanel Constants

Constant	Value	Description

ssNone	0	No autosizing.

ssWidthToCaption	1	Autosize panel width to caption.

ssHeightToCaption	2	Autosize panel height to caption.

ssChildToPanel	3	Autosize child form to panel.

Bevel Constants

Constant	Value	Description

ssNone	0	No inner or outer bevel.

ssInset	1	Inset inner or outer bevel.

ssRaised	2	Raised inner or outer bevel.

FloodType Constants

Constant	Value	Description

ssNone	0	No flood.

ssLeftToRight	1	Flood from left to right.

ssRightToLeft	2	Flood from right to left.

ssTopToBottom	3	Flood from top to bottom.

ssBottomToTop	4	Flood from bottom to top.

ssWideningCircle	5	Flood in widening circle.

Font3D Constants

Constant	Value	Description

ssNone	0	No 3-D text font.

ssRaisedLight	1	Font raised with light shading.

ssRaisedHeavy	2	Font raised with heavy shading.

ssInsetLight	3	Font inset with light shading.

ssInsetHeavy	4	Font inset with heavy shading.

PictureDnChange Constants

Constant	Value	Description

ssNoChange	0	Use Up bitmap with no change.

ssDither	1	Dither Up bitmap.

ssInvert	2	Invert Up bitmap.

Shadow Color Constants

Constant	Value	Description

ssDarkGrey	0	Dark gray shadow.

ssBlack	1	Black shadow.

ShadowStyle Constants

Constant	Value	Description

ssInset	0	Shadow inset.

ssRaised	1	Shadow raised.


Animated Button Control Constants

See Also

Cycle Constants

Constant	Value	Description

aniHalfHalf	0	Animated button display.

aniByFrame	1	Automatic multistate display.

aniTwoStateHalfHalf	2	Two-state display.

ClickFilter Constants

Constant	Value	Description

aniAnywhere	1	Mouse clicks detected anywhere.

aniTextOrPicture	2	Mouse clicks detected on caption text or image frame.

aniPictureOnly	3	Mouse clicks detected on image frame.

aniTextOnly	4	Mouse clicks detected on caption text.

PictDrawMode Constants

Constant	Value	Description

aniAsDefined	0	Positions image at X and Y settings.

aniAutoSize	1	Automatically controls sizing mode.

aniStretch	2	Stretches image to fit button.

TextPos Constants

Constant	Value	Description

aniTextOnPicture	0	Positions caption at X and Y settings.

aniTextLeft	1	Positions image at left of control.

aniTextRight	2	Positions image at right of control.

aniTextBelow	3	Positions image at bottom of control.

aniTextAbove	4	Positions image at top of control.


Gauge Control Constants

See Also

Style Constants

Constant	Value	Description

gauHoriz	0	Horizontal linear gauge with fill.

gauVert	1	Vertical gauge with fill.

gauSemi	2	Semicircular needle gauge.

gauFull	3	Full circle needle gauge.


Graph Control Constants

See Also

AutoInc Constants

Constant	Value	Description

gphOff	0	Automatic incrementing off.

gphOn	1	Automatic incrementing on.

DrawLineStyle and LegendStyle Constants

Constant	Value	Description

gphMonochrome	0	Sets background white and all colors black.

gphColor	1	Uses specified colors.

GraphType Constants

Constant	Value	Description

gphNone	0	No graph.

gphPie2d	1	Two-dimensional pie chart.

gphPie3d	2	Three-dimensional pie chart.

gphBar2d	3	Two-dimensional bar chart.

gphBar3d	4	Three-dimensional bar chart.

gphGantt	5	Gantt chart.

gphLine	6	Line graph.

gphLogLin	7	Log/Lin graph.

gphArea	8	Area graph.

gphScatter	9	Scatter graph.

gphPolar	10	Polar graph.

gphHLC	11	High-low-close graph.

BackgroundColor, ForegroundColor, and ColorData Constants

Constant	Value	Description

gphBlack	0	Black.

gphBlue	1	Blue.

gphGreen	2	Green.

gphCyan	3	Cyan.

gphRed	4	Red.

gphMagenta	5	Magenta.

gphBrown	6	Brown.

gphLightGray	7	Light gray.

gphDarkGray	8	Dark gray.

gphLightBlue	9	Light blue.

gphLightGreen	10	Light green.

gphLightCyan	11	Light cyan.

gphLightRed	12	Light red.

gphLightMagenta	13	Light magenta.

gphYellow	14	Yellow.

gphWhite	15	White.

gphAutoBW	16	(Default) Automatic black and white. Only available in Foreground constants.

SymbolData Constants

Constant	Value	Description

gphCrossPlus	0	Plus sign (+) symbol.

gphCrossTimes	1	Multiplication sign (x) symbol.

gphTriangleUp	2	Upright triangle symbol.

gphSolidTriangle	3	Solid triangle symbol.

gphTriangleDown	4	Upside-down triangle symbol.

gphSolidTriangle	5	Solid triangle symbol.

gphSquare	6	Square symbol.

gphSolidSquare	7	Solid square symbol.

gphDiamond	8	Diamond symbol.

gphSolidDiamond	9	Solid diamond symbol.

GridStyle Constants

Constant	Value	Description

gphNone	0	No grid.

gphHorizontal	1	Horizontal grid.

gphVertical	2	Vertical grid.

gphBoth	3	Both grids.

DataReset Constants

Constant	Value	Description

gphNone	0	No reset.

gphGraphData	1	Resets graph data.

gphColorColorData	2	Resets color data.

gphExtraData	3	Resets extra data.

gphLabelText	4	Resets label text.

gphLegendText	5	Resets legend text.

gphPatternData	6	Resets pattern data.

gphSymbolData	7	Resets symbol data.

gphXPosData	8	Resets x-position data.

gphAllData	9	Resets all data.

gphFontInfo	10	Resets font information.

DrawMode Constants

Constant	Value	Description

gphNoAction	0	No graph drawn at design time.

gphClear	1	No graph drawn at design time, but properties 	displayed.

gphDraw	2	Displays graph at design time and run time.

gphBlit	3	Displays graph using blitting technique.

gphCopy	4	Copies graph to Clipboard.

gphPrint	5	Sends graph to printer.

gphWrite	6	Writes graph to disk.

FontStyle Constants

Constant	Value	Description

gphDefault	0	Default.

gphItalic	1	Italic.

gphBold	2	Bold.

gphBoldItalic	3	BoldItalic.

gphUnderlined	4	Underlined.

gphUnderlinedItalic	5	UnderlinedItalic.

gphUnderlinedBold	6	UnderlinedBold.

gphUnderlinedBoldItalic	7	UnderlinedBoldItalic.

FontFamily Constants

Constant	Value	Description

gphRoman	0	Roman.

gphSwiss	1	Swiss.

gphModern	2	Modern.

FontUse Constants

Constant	Value	Description

gphGraphTitle	0	GraphTitle.

gphOtherTitles	1	OtherTitles.

gphLabels	2	Labels.

gphLegend	3	Legend.

gphAllText	4	AllText.

IndexStyle Constants

Constant	Value	Description

gphStandard	0	Standard.

gphEnhanced	1	Enhanced.

Labels Constants

Constant	Value	Description

gphOff	0	Off.

gphOn	1	On.

gphXAxisLabelsOnly	2	X-axis labels only.

gphYAxisLabelsOnly	3	Y-axis labels only.

LineStats Constants

Constant	Value	Description

gphNone	0	None.

gphMean	1	Mean.

gphMinmax	2	MinMax.

gphMeanMinmax	3	Mean and MinMax.

gphStddev	4	Stddev.

gphStddevMean	5	StdDev and Mean.

gphStddevMinmax	6	StdDev and MinMax.

gphStddevMinmaxMean	7	StdDev and MinMax and Mean.

gphBestfit	8	BestFit.

gphBestfitMean	9	BestFit and Mean.

gphBestfitMinmax	10	BestFit and MinMax.

gphBestfitMinmaxMean	11	BestFit and MinMax and Mean.

gphBestfitStddev	12	BestFit and StdDev.

gphBestfitStddevMean	13	BestFit and StdDev and Mean.

gphBestfitStddevMinmax	14	BestFit and StdDev and MinMax.

gphAll	15	All.

Palette Constants

Constant	Value	Description

gphDefault	0	Default.

gphPastel	1	Pastel.

gphGrayscale	2	Grayscale.

PatternedLines Constants

Constant	Value	Description

gphPatternOff	0	Pattern off.

gphPatternOn	1	Pattern on.

PrintStyle Constants

Constant	Value	Description

gphMonochrome	0	Color.

gphColor	1	Color with border.

gphMonochromeWithBorder	2	Monochrome.

gphColorWithBorder	3	Monochrome with border.

RandomData Constants

Constant	Value	Description

gphOff	0	Off.

gphOn	1	On.

ThickLines Constants

Constant	Value	Description

gphLinesOff	0	Lines off.

gphLinesOn	1	Lines on.

YAxisPos Constants

Constant	Value	Description

gphDefault	0	Default.

gphAlignLeft	1	Align left.

gphAlignRight	2	Align right.

YAxisStyle Constants

Constant	Value	Description

gphDefault	0	Default.

gphVariableOrigin	1	Variable origin.

gphUserDefined	2	User-defined.

Ticks Constants

Constant	Value	Description

gphTicksOff	0	Ticks off.

gphTicksOn	1	Ticks on.

gphXAxisTicksOnly	2	X-axis ticks only.

gphYAxisTicksOnly	3	Y-axis ticks only.


Key State Control Constants

See Also

Style Constants

Constant	Value	Description

keyCapsLock	0	CAPS LOCK key.

keyNumLock	1	NUM LOCK key.

keyInsert	2	INSERT key.

keyScrollLock	3	SCROLL LOCK key.


Multimedia MCI Control Constants

See Also

Mode Constants

Constant	Value	Description

mciModeOpen	524	Device not open.

mciModeStop	525	Device stop.

mciModePlay	526	Device play.

mciModeRecord	527	Device record.

mciModeSeek	528	Device seek.

mciModePause	529	Device pause.

mciModeReady	530	Device ready.

Notify Constants

Constant	Value	Description

mciNotifySuccessful	1	Command completed successfully.

mciNotifySuperseded	2	Command superseded by another command.

mciAborted	4	Command aborted by user.

mciFailure	8	Command failed.

Orientation Constants

Constant	Value	Description

mciOrientHorz	0	Buttons arranged horizontally.

mciOrientVert	1	Buttons arranged vertically.

RecordMode Constants

Constant	Value	Description

mciRecordInsert	0	Insert recording mode.

mciRecordOverwrite	1	Overwrite recording mode.

Format Constants

Constant	Value	Description

mciFormatMilliseconds	0	Milliseconds format.

mciFormatHms	1	Hours, seconds, and minutes format.

mciFormatMsf	2	Minutes, seconds, and frames format.

mciFormatFrames	3	Frames format.

mciFormatSmpte24	4	24-frame SMPTE format.

mciFormatSmpte25	5	25-frame SMPTE format.

mciFormatSmpte30	6	30-frame SMPTE format.

mciFormatSmpte30Drop	7	30-drop-frame SMPTE format.

mciFormatBytes	8	Bytes format.

mciFormatSamples	9	Samples format.

mciFormatTmsf	10	Tracks minutes, seconds, and frames format.


Spin Button Control Constants

See Also

Orientation Constants

Constant	Value	Description

spnVertical	0	Up and down spin arrows.

spnHorizontal	1	Left and right spin arrows.


Masked Edit Control Constants

See Also

ClipMode Constants

Constant	Value	Description

mskIncludeLiterals	0	Include literals on cut or copy.

mskExcludeLiterals	1	Exclude literals on cut or copy.


Communications Control Constants

See Also

Handshake Constants

Constant	Value	Description

comNone	0	No handshaking.

comXonXoff	1	XOn/XOff handshaking.

comRTS	2	Request-to-send/clear-to-send handshaking.

comRTSXOnXOff	3	Both request-to-send and XOn/XOff handshaking.

OnComm Constants

Constant	Value	Description

comEvSend	1	Send event.

comEvReceive	2	Receive event.

comEvCTS	3	Change in clear-to-send line.

comEvDSR	4	Change in data-set ready line.

comEvCD	5	Change in carrier detect line.

comEvRing	6	Ring detect.

comEvEOF	7	End of file.

Error Constants

Constant	Value	Description

comBreak	1001	Break signal received.

comCTSTO	1002	Clear-to-send timeout.

comDSRTO	1003	Data-set ready timeout.

comFrame	1004	Framing error.

comOverrun	1006	Port overrun.

comCDTO	1007	Carrier detect timeout.

comRxOver	1008	Receive buffer overflow.

comRxParity	1009	Parity error.

comTxFull	1010	Transmit buffer full.


MAPI Control Constants

See Also

SessonAction Constants

Constant	Value	Description

mapSignOn	1	Log user into account.

mapSignOff	2	End messaging session.

Delete Constants

Constant	Value	Description

mapMessageDelete	10	Delete current message.

mapRecipientDelete	14	Delete the currently indexed recipient.

mapAttachmentDelete	15	Delete the currently indexed attachment.

MAPIErrors

Constant	Value	Description

mapSuccessSuccess	32000	Action returned successfully.

mapUserAbort	32001	User cancelled process.

mapFailure	32002	Unspecified failure.

mapLoginFail	32003	Login failure.

mapDiskFull	32004	Disk full.

mapInsufficientMem	32005	Insufficient memory.

mapAccessDenied	32006	Access denied.

mapGeneralFailure	32007	General failure.

mapTooManySessions	32008	Too many sessions.

mapTooManyFiles	32009	Too many files.

mapTooManyRecipients	32010	Too many recipients.

mapAttachmentNotFound	32011	Attachment not found.

mapAttachmentOpenFailure	32012	Attachment open failure.

mapAttachmentWriteFailure	32013	Attachment write failure.

mapUnknownRecipient	32014	Unknown recipient.

mapBadRecipType	32015	Invalid recipient type.

mapNoMessages	32016	No message.

mapInvalidMessage	32017	Invalid message.

mapTextTooLarge	32018	Text too large.

mapInvalidSession	32019	Invalid session.

mapTypeNotSupported	32020	Type not supported.

mapAmbiguousRecipient	32021	Ambiguous recipient.

mapMessageInUse	32022	Message in use.

mapNetworkFailure	32023	Network failure.

mapInvalidEditFields	32024	Invalid editfields.

mapInvalidRecips	32025	Invalid Recipients.

mapNotSupported	32026	Current action not supported.

mapUserAbout	32027	User aborted previous action.

mapSessionExist	32050	Session ID already exists.

mapInvalidBuffer	32051	Read-only in read buffer.

mapInvalidReadBufferAction	32052	Valid in compose buffer only.

mapNoSession	32053	No valid session ID.

mapInvalidRecipient	32054	Originator information not available.

mapInvalidComposeBufferAction	32055	Action not valid for Compose Buffer.

mapControlFailure	32056	No messages in list.

mapNoRecipients	32057	No recipients.

mapNoAttachment	32058	No attachments.

RecipType Constants

Constant	Value	Description

mapOrigList	0	Message originator.

mapToList	1	Recipient is a primary recipient.

mapCcList	2	Recipient is a copy recipient.

mapBccList	3	Recipient is a blind copy recipient.

AttachType Constants

Constant	Value	Description

mapData	0	Attachment is a data file.

mapEOLE	1	Attachment is an embedded OLE object.

mapSOLE	2	Attachment is a static OLE object.


See Also

Error Messages, MAPI Controls

Visual Basic Custom Control Constants


Outline Control Constants

See Also

PictureType Constants

Constant	Value	Description

outClosed	0	PictureClosed picture.

outOpen	1	PictureOpen picture.

outLeaf	2	PictureLeaf picture.

Error Constants

Constant	Value	Description

outBadPicFormat	32000	Picture format not supported.

outBadIndentation	32001	Bad outline indentation.

outOutOfMemory	32002	Out of memory.

outParentNotExpanded	32003	Parent not expanded.

Style Constants

Constant	Value	Description

outTextOnly	0	Picture and text.

outPictureText	1	Plus/Minus and text.

outPlusMinusText	2	Plus/Minus, picture, and text.

outPlusPictureText	3	Text only.

outTreelinesText	4	Treelines, picture, and text.

outTreelinesPictureText	5	Treelines and text.


See Also

Visual Basic Custom Control Constants


Visual Basic Custom Control Constants

The following constants are specified by Visual Basic.  As a result, they can be used anywhere in your code in place of the actual values.

3D Controls Constants

Animated Button Control Constants

Communications Control Constants

Gauge Control Constants

Graph Control Constants

Key State Control Constants

MAPI Control Constants

Masked Edit Control Constants

Multimedia MCI Control Constants

Spin Button Control Constants

Windows 95 Control Constants

You can search for data access, Visual Basic, and Visual Basic for application constants for more constant lists.

Use the Object Browser to browse the list of built-in constants.  From the View menu, choose Object Browser, select the appropriate library, and then select the constants you want to see.  Scroll the list in the Methods/Properties box to see the complete list of constants.


Me

The Me keyword in Visual Basic behaves like an implicitly declared variable.  It is automatically available to every procedure in a class module.  When a class can have more than one instance, Me provides a way to refer to the specific instance of the class where the code is executing.  Using Me is particularly useful when you want to pass information about the currently executing instance of a class to a procedure in another module.  For example, suppose you have the following procedure in a module:

Sub ChangeFormColor(FormName As Form)

FormName.BackColor = RGB(Rnd * 256, Rnd * 256, Rnd * 256)

End Sub

You can call this procedure and pass the current instance of the Form class as an argument using the following statement in one of the procedures in your form code:

ChangeFormColor Me


Nothing

The Nothing keyword in Visual Basic is used to disassociate an object variable from any actual object.  Use the Set statement to assign Nothing to an object variable.  For example:

Set MyObject = Nothing

Several object variables can refer to the same actual object.  When Nothing is assigned to an object variable, that variable no longer refers to any actual object.  When several object variables refer to the same object, memory and system resources associated with the object to which the variables refer are released only after all of them have been set to Nothing, either explicitly using Set, or implicitly after the last object variable set to Nothing goes out of scope.


Add Method (Collection Object)
Add Method

See Also

Adds a member to a Collection object.

Syntax

object.Add(item, key, before, after)

The Add method syntax has the following object qualifier and named-arguments:

Part	Description

object	Required.  An object expression that evaluates to an object in the Applies To list.

item	Required.  An expression of any type that specifies the member to add to the collection.

key	Optional.  A unique string expression that specifies a key string that can be used, instead of a positional index, to access a member of the collection.

before	Optional.  An expression that specifies a relative position in the collection.  The member to be added is placed in the collection before the member identified by the before argument.  If a numeric expression, before must be a number from 1 to the value of the collection's Count property.  If a string expression, before must correspond to the key specified when the member being referred to was added to the collection.  You can specify before or after positions but not both.

after	Optional.  An expression that specifies a relative position in the collection.  The member to be added is placed in the collection after the member identified by the after argument.  If numeric, after must be a number from 1 to the value of the collection's Count property.  If a string, after must correspond to the key specified when the member being referred to was added to the collection.  You can specify before or after positions but not both.

Remarks

An error occurs if a value provided for before or after would not return a member of the collection when provided to the Item method as the index.  In other words, whether the before or after argument is a string or numeric expression, it must refer to an existing member of the collection.

An error also occurs if a specified key duplicates the key for an existing member of the collection.


See Also

Item Method

Remove Method


Item Method

See Also	Applies To

Returns a specific member of a collection, either by position or by key.

Syntax

object.Item(index)

The Item method syntax has the following object qualifier and part:

Part	Description

object	Required.  An object expression that evaluates to an object in the Applies To list.

index	Required.  An expression that specifies the position of a member of the collection.  If a numeric expression, index must be a number from 1 to the value of the collection's Count property.  If a string expression, index must correspond to the key specified when the member being referred to was added to the collection.

Remarks

If the value provided as index does not match any existing member of the collection, an error occurs.

The Item method is the default method for a collection.  Therefore, the following lines of code are equivalent:

Print MyCollection(1)

Print MyCollection.Item(1)


See Also

Add Method

Remove Method


Item Method Applies To

Form Collection


Print Method

See Also	Applies To

Debug object [image] Prints text in the Immediate pane of the Debug window.

Form object [image] Prints text on a form.

PictureBox control [image] Prints text in a picture box.

Printer object [image] Prints text on the object.

Syntax

object.Print outputlist

The Print method syntax has the following object qualifier and part:

Part	Description

object	Optional.  An object expression that evaluates to an object in the Applies To list.

outputlist	Optional.  Expression or list of expressions to print.  If omitted, a blank line is printed.

The outputlist argument has the following syntax and parts:

{Spc(n) | Tab(n)} expression charpos

Part	Description

Spc(n)	Optional.  Used to insert space characters in the output, where n is the number of space characters to insert.

Tab(n)	Optional.  Used to position the insertion point at an absolute column number where n is the column number.  Use Tab with no argument to position the insertion point at the beginning of the next print zone.

expression	Optional.  Numeric or string expressions to print.

charpos	Optional.  Specifies the insertion point for the next character.  Use a semicolon to position the insertion point immediately following the last character displayed.  Use Tab(n) to position the insertion point at an absolute column number.  Use Tab with no argument to position the insertion point at the beginning of the next print zone.  If charpos is omitted, the next character is printed on the next line.

Remarks

Multiple expressions can be separated with either a space or a semicolon.  A space has the same effect as a semicolon.

For the Debug object, all data printed to the Immediate pane is internationally aware; that is, the data is properly formatted (using the appropriate decimal separator).

When you use the Print method with the Printer object, graphical images are clipped at the bottom of the page and text is carried over to the next page.

For Boolean data, either True or False is printed.

Date data is written using the standard short date format recognized by your system.  When either the date or the time component is missing or zero, only the data provided is written.

Nothing is written if outputlist data is Empty.  However, if outputlist data is Null, Null is output.

For error data, the output is written as Error errorcode.

Note   Because the Print method normally prints with proportionally-spaced characters, it is important to remember that there is no correlation between the number of characters printed and the number of fixed-width columns those characters occupy.  For example, a wide letter, such as a "W", occupies more than one fixed-width column, whereas a narrow letter, such as an "i", occupies less.  To account for cases where wider than average characters are used, you must ensure that your tabular columns are positioned far enough apart.  Alternatively, you can print using a fixed-pitch font (such as Courier) to ensure that each character uses only one column.


See Also

Print # Statement

Spc Function

Tab Function


Print Method Applies To

Form Object

PictureBox Control


Remove Method (Collection Object)
Remove Method

See Also

Removes a member from a Collection object.

Syntax

object.Remove index

The Remove method syntax has the following object qualifier and part:

Part	Description

object	Required.  An object expression that evaluates to an object in the Applies To list.

index	Required.  An expression that specifies the position of a member of the collection.  If a numeric expression, index must be a number from 1 to the value of the collection's Count property.  If a string expression, index must correspond to the key specified when the member being referred to was added to the collection.

Remarks

If the value provided as index does not match any existing member of the collection, an error occurs.


See Also

Add Method


Conversion Functions

Asc Function

CBool Function

CByte Function

CCur Function

CDate Function

CDbl Function

Chr Function

CInt Function

CLng Function

CSng Function

CStr Function

CVar Function

CVErr Function

Format Function

Hex Function

Oct Function

Str Function

Val Function


Asc Function

See Also

Returns the 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   Another function (AscB) is provided for use with byte data contained in a string.  Instead of returning the character code for the first character, AscB returns the first byte.


See Also

Character Set

Chr Function

Conversion Functions


CBool Function

See Also

Converts an expression to a Boolean.

Syntax

CBool(expression)

The expression argument is any valid numeric or string 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.


See Also

Conversion Functions


CByte Function

See Also

Converts an expression to a Byte.

Syntax

CByte(expression)

The expression argument is any valid numeric or string 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 CByte to force byte arithmetic in cases where currency, single-precision, double-precision, or integer arithmetic normally would occur.

You should use the CByte function instead of Val to provide internationally-aware conversions from any other data type to a Byte.  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 data type, an error occurs.


See Also

Conversion Functions


CCur Function

See Also

Converts an expression to a Currency.

Syntax

CCur(expression)

The expression argument is any valid numeric or string 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 CCur to force currency arithmetic in cases where single-precision, double-precision, or integer arithmetic normally would occur.

You should use the CCur function instead of Val to provide internationally-aware conversions from any other data type to a Currency.  For example, different decimal separators are properly recognized depending on the locale setting of your computer, as are different thousand separators and various currency options.

If expression lies outside the acceptable range for the Currency data type, an error occurs.


See Also

Conversion Functions


CDate Function

See Also

Converts an expression to a Date.

Syntax

CDate(date)

The date argument is any valid date expression.

Remarks

Use the IsDate function to determine if date can be converted to a date or time.  CDate recognizes date 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.

Note   A CVDate function is also provided for compatibility with previous versions of Visual Basic.  However, since there is now an intrinsic Date type, there is no further need for CVDate.  The syntax of the CVDate function is identical to the CDate function.  The difference is that it returns a Variant whose subtype is Date instead of an actual Date type.  The same effect can be achieved by converting an expression to a Date and then assigning it to a Variant.  This technique is consistent with the conversion of all other intrinsic types to their equivalent Variant subtypes.


See Also

Conversion Functions

DateSerial Function


CDbl Function

See Also

Converts an expression to a Double.

Syntax

CDbl(expression)

The expression argument is any valid numeric or string 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- or single-precision arithmetic in cases where currency or integer arithmetic normally would occur.

You should use the CDbl function instead of Val to provide internationally aware conversions from any other data type to a Double.  For example, different decimal separators and thousands separators are properly recognized depending on the locale setting of your system.


See Also

Conversion Functions


CInt Function

See Also

Converts an expression to an Integer.

Syntax

CInt(expression)

The expression argument is any valid numeric or string 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 CInt or CLng to force integer arithmetic in cases where currency, single-precision, or double-precision arithmetic normally would occur.

You should use the CInt function instead of Val to provide internationally-aware conversions from any other data type to an Integer.  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 data type, 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 CInt function always rounds it to the nearest even number.  For example, 0.5 rounds to 0, and 1.5 rounds to 2.


See Also

Conversion Functions


CLng Function

See Also

Converts an expression to a Long.

Syntax

CLng(expression)

The expression argument is any valid numeric or string 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 CInt or CLng to force integer arithmetic in cases where currency, single-precision, or double-precision arithmetic normally would occur.

You should use the CLng function instead of Val to provide internationally-aware conversions from any other data type to a Long.  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 data type, 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 CLng function always rounds it to the nearest even number.  For example, 0.5 rounds to 0, and 1.5 rounds to 2.


See Also

Conversion Functions


CSng Function

See Also

Converts an expression to a Single.

Syntax

CSng(expression)

The expression argument is any valid numeric or string 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- or single-precision arithmetic in cases where currency or integer arithmetic normally would occur.

You should use the CSng function instead of Val to provide internationally-aware conversions from any other data type to a Single.  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 data type, an error occurs.


See Also

Conversion Functions


CStr Function

See Also

Converts an expression to a String.

Syntax

CStr(expression)

The expression argument is any valid numeric or string 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 CStr function instead of Str to provide internationally-aware conversions from any other data type to a String.  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.


See Also

Conversion Functions

Str Function


CVar Function

See Also

Converts an expression to a Variant.

Syntax

CVar(expression)

The expression argument is any valid numeric or string 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 CVar to force the result to be expressed as a Variant.


See Also

Conversion Functions


CVErr Function

See Also

Returns a Variant of subtype Error containing an error number specified by the user.

Syntax

CVErr(errornumber)

The errornumber argument is any valid error number.

Remarks

Use the CVErr function to create user-defined errors in user-created procedures.  For example, if you create a function that accepts several arguments and normally returns a string, you can have your function evaluate the input arguments to ensure they are within acceptable range.  If they are not, it is likely that your function will not return what you expect.  In this event, CVErr allows you to return an error number that tells you what action to take.

Note that implicit conversion of an Error is not allowed.  For example, you can't directly assign the return value of CVErr to a non-Variant variable.  However, you can perform an explicit conversion (using CInt, CDbl, and so on) of the value returned by CVErr and assign that to a variable of the appropriate data type.


See Also

Conversion Functions


Val Function

See Also

Returns the numbers contained in a string.

Syntax

Val(string)

The string argument is any valid string expression.

Remarks

The Val function stops reading the string at the first character it can't recognize as part of a number.  Symbols and characters that are often considered parts of numeric values, such as dollar signs and commas, are not recognized.  However, the function recognizes radix prefixes &O (for octal) and &H (for hexadecimal).  Blanks, tabs, and linefeeds are stripped from the argument.

The following returns the value 1615198:

Val("    1615 198th Street N.E.")

In the code below, Val returns the decimal value -1 for the hexadecimal value shown:

Val("&HFFFF")

Note   The Val function recognizes only the period (.) as a valid decimal separator.  When a possibility exists that different decimal separators may be used (for example, in international applications), you should use CDbl instead to convert a string to a number.


See Also

CDbl Function

Str Function


Call Statement

Transfers control to a Sub procedure, Function procedure, dynamic-link library (DLL) 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	Name of the procedure to call.

argumentlist	Comma-delimited list of variables, arrays, or expressions to pass to the procedure.  Components of argumentlist may include the keywords ByVal or ByRef to describe how the arguments are to be treated by the called procedure.  However, ByVal and ByRef can be used with Call only when making a call to a DLL 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.

To pass a whole array to a procedure, use the array name followed by empty parentheses.


DoEvents Function

See Also

Yields execution so that the operating system can process other events.

Syntax

DoEvents( )

Note   For Visual Basic in-process OLE server (DLL) considerations and restrictions that apply to this topic, see Make OLE DLL File Command.

Remarks

The DoEvents function returns the number of open forms.

DoEvents passes control to the operating system.  Control is not returned until the operating system has finished processing the events in its queue and  all keys in the SendKeys queue have been sent.

If parts of your code take up a lot of processor time, use DoEvents periodically to relinquish control to the operating system so that events, such as keyboard input and mouse clicks, can be processed without significant delay.

Caution   Make sure the procedure that has given up control with DoEvents is not executed again from a different part of your code before the first DoEvents call returns; this could cause unpredictable results.  In addition, do not use DoEvents if other applications could possibly interact with your procedure in unforeseen ways during the time you have yielded control.


See Also

SendKeys Statement


Do...Loop Statement

See Also

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 equally valid 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.


See Also

Exit Statement

For...Next Statement

While...Wend Statement


End Statement

See Also

Ends a procedure or block.

Syntax

End

End Function

End If

End Property

End Select

End Sub

End Type

End With

The End statement syntax has these forms:

Statement	Description

End	Terminates execution.  Never required by itself but may be placed anywhere in a procedure to close files opened with the Open statement and to clear variables.

End Function	Required to end a Function statement.

End If	Required to end a block If...Then...Else statement.

End Property	Required to end a Property Let, Property Get, or Property Set procedure.

End Select	Required to end a Select Case statement.

End Sub	Required to end a Sub statement.

End Type	Required to end a user-defined type definition (Type statement).

End With	Required to end a With statement.

Note   For Visual Basic in-process OLE server (DLL) considerations and restrictions that apply to this topic, see Make OLE DLL File Command.

Remarks

When executed, the End statement resets all module-level variables and all static local variables in all modules.  If you need to preserve the value of these variables, use the Stop Statement instead.  You can then resume execution while preserving the value of those variables.


See Also

Exit Statement

If...Then...Else Statement

Select Case Statement

Stop Statement

With Statement


Exit Statement

See Also

Exits a block of Do...Loop, For...Next, Function, Sub, or Property code.

Syntax

Exit Do

Exit For

Exit Function

Exit Property

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 Property	Immediately exits the Property procedure in which it appears.  Execution continues with the statement following the statement that called the Property procedure.

Exit Sub	Immediately exits the Sub procedure in which it appears.  Execution continues with the statement following the statement that called the Sub.

Remarks

Do not confuse Exit statements with End statements.  Exit does not define the end of a structure.


See Also

Do...Loop Statement

End Statement

For...Next Statement

For Each...Next Statement

Stop Statement


For Each...Next Statement

See Also

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 OLE Automation object variable.  For arrays, element can only be a Variant variable.

group	Name of an object collection or array (except an array of user-defined types).

statements	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.  Then, 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.

Note   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.

You can't use the For Each...Next statement with an array of user-defined types because a Variant can't contain a user-defined type.


See Also

Do...Loop Statement

Exit Statement

For...Next Statement

While...Wend Statement


For...Next Statement

See Also

Repeats a group of statements a specified number of times.

Syntax

For counter = start To end [Step step]
[statements]
[Exit For]
[statements]
Next [counter]

The For...Next statement syntax has these parts:

Part	Description

counter	Numeric variable used as a loop counter.  The variable can't be 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.

Tip   Changing the value of counter while inside a loop can make it more difficult to read and debug your code.

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...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 K

Next J

Next I

Note   If you omit counter 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.


See Also

Do...Loop Statement

Exit Statement

For Each...Next Statement

While...Wend Statement


GoSub...Return Statement

See Also

Branches to and returns from a subroutine within a procedure.

Syntax

GoSub line
. . .
line
. . .
Return

The line argument can be any line label or line number.

Remarks

You can use GoSub and Return anywhere in a procedure, but GoSub and the corresponding Return must be in the same procedure.  A subroutine can contain more than one Return statement, but the first Return statement encountered causes the flow of execution to branch back to the statement immediately following the most recently executed GoSub statement.

Note   You can't enter or exit Sub procedures with GoSub...Return.

Tip   Creating separate procedures that you can call may provide a more structured alternative to using GoSub...Return.


See Also

GoTo Statement

On...GoSub Statement

On...GoTo Statement


GoTo Statement

See Also

Branches unconditionally to a specified line within a procedure.

Syntax

GoTo line

The line argument can be any line label or line number.

Remarks

GoTo can branch only to lines within the procedure where it appears.

Note   Too many GoTo statements can be difficult to read and debug.  Use structured control statements (Do...Loop, For...Next, If...Then...Else, Select Case) whenever possible.


See Also

Do...Loop Statement

For...Next Statement

GoSub...Return Statement

If...Then...Else Statement

Select Case Statement


If...Then...Else Statement

See Also

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 following, more versatile 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.

statements	One or more statements separated by colons; executed if condition is True.

condition-n	Same as condition.

elseifstatements	One or more statements executed if associated condition-n is True.

elsestatements	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.

Note   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 condition (if any) is evaluated in turn.  When a True condition is found, the statements immediately following the associated Then are executed.  If none of the ElseIf conditions are True (or if 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 clauses as you want in a block If, but none can appear after an 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 Else, ElseIf, and End If parts of the statement can have only a line number or line label preceding them.  The block If must end with an End If statement.

Tip   Select Case may be more useful when evaluating a single expression that has several possible actions. However, the TypeOf objectname Is objecttype clause can't be used with the Select Case statement.


See Also

Select Case Statement


On...GoSub, On...GoTo Statements

See Also

Branch to one of several specified lines, depending on the value of an expression.

Syntax

On expression GoSub destinationlist

On expression GoTo destinationlist

The On...GoSub and On...GoTo statement syntax has these parts:

Part	Description

expression	Any numeric expression that evaluates to a whole number between 0 and 255, inclusive.  If expression is any number other than a whole number, it is rounded before it is evaluated.

destinationlist	List of line numbers or line labels separated by commas.

Remarks

The value of expression determines which line in destinationlist is branched to.  If the value of expression is less than 1 or greater than the number of items in the list, one of the following results occurs:

If expression is	Then
Equal to 0	Control drops to the statement following On...GoSub or On...GoTo.
Greater than number of items in list	Control drops to the statement following On...GoSub or On...GoTo.
Negative	An error occurs.
Greater than 255	An error occurs.
You can mix line numbers and line labels in the same list.  There is no practical limit to the number of line labels and line numbers you can use with On...GoSub and On...GoTo.  However, if you use more labels or numbers than fit on a single line, you must use the line-continuation character to continue the logical line onto the next physical line.

Tip   Select Case provides a more structured and flexible way to perform multiple branching.


See Also

GoSub...Return Statement

GoTo Statement

Select Case Statement


Select Case Statement

See Also

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
[elsestatements]]
End Select

The Select Case statement syntax has these parts:

Part 	Description

testexpression	Any numeric or string expression.

expressionlist-n	Delimited list of one or more of the following forms: expression, expression To expression, Is comparisonoperator expression.  The To keyword specifies a range of values.  If you use the To keyword, the smaller value must appear before To.  Use the Is keyword with comparison operators (except Is and Like) to specify a range of values.  If not supplied, the Is keyword is automatically inserted.

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 clause.

Remarks

If testexpression matches any expressionlist expression associated with a Case clause, the statements following that Case clause are executed up to the next Case clause, or, for the last clause, up to the 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 statements to be executed if no match is found between the testexpression and an expressionlist in any of the other Case selections.  When there is no Case Else statement and no expression listed in the Case clauses matches testexpression, execution continues at the statement following End Select.

Although not required, it is a good idea to have a Case Else statement in your Select Case block to handle unforeseen testexpression values.

You can use multiple expressions or ranges in each Case clause.  For example, the following line is valid:

Case 1 To 4, 7 To 9, 11, 13, Is > MaxNumber

Note   The Is comparison operator is not the same as the Is keyword used in the Select Case statement.

You also can specify ranges and multiple expressions for character strings.  In the following example, Case matches strings that are exactly equal to everything, strings that fall between nuts and soup in alphabetical order, and the current value of TestItem:

Case "everything", "nuts" To "soup", TestItem

Select Case statements can be nested.  Each Select Case statement must have a matching End Select statement.


See Also

If...Then...Else Statement

On...GoSub Statement

On...GoTo Statement


Shell Function

See Also

Runs an executable program.

Syntax

Shell(pathname[, windowstyle])

The Shell function syntax has these named arguments:

Part	Description

pathname	Name of the program to execute and any required arguments or command line switches; may include directory and drive.  May also be the name of a document that has been associated with an executable program.

windowstyle	Number corresponding to the style of the window in which the program is to be run.  If windowstyle is omitted, the program is started minimized with focus.

The windowstyle named argument has these values:

Constant	Value	Description

vbHide	0	Window is hidden and focus is passed to the hidden window.

vbNormalFocus	1	Window has focus and is restored to its original size and position.

vbMinimizedFocus	2	Window is displayed as an icon with focus.

vbMaximizedFocus	3	Window is maximized with focus.

vbNormalNoFocus	4	Window is restored to its most recent size and position. The currently active window remains active.

vbMinimizedNoFocus	6	Window is displayed as an icon. The currently active window remains active.

Remarks

If the Shell function successfully executes the named file, it returns the task identification (ID) of the started program.  The task ID is a unique number that identifies the running program.  If the Shell function can't start the named program, an error occurs.

Note   The Shell function runs other programs asynchronously.  This means you can't depend on a program started with Shell to be finished executing before the statements following the Shell function in your application are executed.


See Also

AppActivate Statement


Stop Statement

See Also

Suspends execution.

Syntax

Stop

Note   For Visual Basic in-process OLE server (DLL) considerations and restrictions that apply to this topic, see Make OLE DLL File Command.

Remarks

You can place Stop statements anywhere in procedures to suspend execution.  Using the Stop statement is similar to setting a breakpoint in the code.

The Stop statement suspends execution, but unlike End, it doesn't close any files or clear variables, unless it is in a compiled executable (.EXE) file.


See Also

End Statement


While...Wend Statement

See Also

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.

statements	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.

Tip   The Do...Loop statement provides a more structured and flexible way to perform looping.


See Also

Do...Loop Statement

With Statement


With Statement

See Also

Executes a series of statements on a single object or a user-defined type.

Syntax

With object
[statements]
End With

The With statement syntax has these parts:

Part	Description

object	Name of an object or a user-defined type.

statements	One or more statements to be executed on object.

Remarks

The With statement allows you to perform a series of statements on a specified object without requalifying the name of the object.  For example, if you have a number of different properties to change on a single object, it is more convenient to place the property assignment statements within the With control structure, referring to the object once instead of referring to it with each property assignment.  The following example illustrates use of the With statement to assign values to several properties of the same object.

With MyLabel

.Height = 2000

.Width = 2000

.Caption = "This is MyLabel"

End With

Note   Once a With block is entered, object can't be changed.  As a result, you can't use a single With statement to affect a number of different objects.

You can nest With statements by placing one With block within another. However, because members of outer With blocks are masked within the inner With blocks, you must provide a fully qualified object reference in an inner With block to any member of an object in an outer With block.

Important   Don't jump into or out of With blocks.  You may get errors or unpredictable behavior if statements in a With block are executed, but either the With or End With statement is not executed.


 See Also

Do...Loop Statement

While...Wend Statement


Date Function

See Also

Returns the current system date.

Syntax

Date

Remarks

To set the system date, use the Date statement.


 See Also

CDate Function

Date Statement

Format Function

Now Function

Time Function

Time Statement


Date Statement

See Also

Sets the current system date.

Syntax

Date = date

For MS-DOS computers, the date argument must be a date from January 1, 1980 through December 31, 2099, or an error occurs.  For Microsoft Windows NT computers, date must be a date from January 1, 1980 through December 31, 2079.

Remarks

If you use the Date statement to set the date on computers using versions of MS-DOS earlier than version 3.3, the change remains in effect only until you change it again or turn off your computer.  Many computers have a battery-powered CMOS RAM that retains date and time information when the computer is turned off.  However, to permanently change the date on computers running earlier versions of MS-DOS, you may have to use your Setup disk or perform some equivalent action.  Refer to the documentation for your particular system.


 See Also

Date Function

Time Function

Time Statement


DateSerial Function

See Also

Returns a Date for a specified year, month, and day.

Syntax

DateSerial(year, month, day)

The DateSerial function syntax has these named 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 normally accepted range for the unit; that is, 1 [image] 31 for days and 1 [image] 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 function 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 [image] 1999.  For all other year arguments, use a complete four-digit year (for example, 1800).

When any argument exceeds the normally 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.


 See Also

Date Function

Date Statement

DateValue Function

Day Function

Month Function

Now Function

TimeSerial Function

TimeValue Function

Weekday Function

Year Function


DateValue Function

See Also

Returns a 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.


 See Also

CDate Function

Date Function

Date Statement

DateSerial Function

Day Function

Month Function

Now Function

TimeSerial Function

TimeValue Function

Weekday Function

Year Function


Day Function

See Also

Returns a whole number between 1 and 31, inclusive, representing the day of the month.

Syntax

Day(date)

The date argument is any numeric or string expression, or any combination, that can represent a date.  If date contains Null, Null is returned.


 See Also

Date Function

Date Statement

Hour Function

Minute Function

Month Function

Now Function

Second Function

Weekday Function

Year Function


Hour Function

See Also

Returns a whole number between 0 and 23, inclusive, representing the hour of the day.

Syntax

Hour(time)

The time argument is any numeric or string expression, or any combination, that can represent a time.  If time contains Null, Null is returned.


 See Also

Day Function

Minute Function

Now Function

Second Function

Time Function

Time Statement


Minute Function

See Also

Returns a whole number between 0 and 59, inclusive, representing the minute of the hour.

Syntax

Minute(time)

The time argument is any numeric or string expression, or any combination, that can represent a time.  If time contains Null, Null is returned.


 See Also

Day Function

Hour Function

Now Function

Second Function

Time Function

Time Statement


Month Function

See Also

Returns a whole number between 1 and 12, inclusive, representing the month of the year.

Syntax

Month(date)

The date argument is any numeric or string expression, or any combination, that can represent a date.  If date contains Null, Null is returned.


 See Also

Date Function

Date Statement

Day Function

Now Function

Weekday Function

Year Function


Now Function

See Also

Returns the current date and time according to the setting of your computer's system date and time.

Syntax

Now


 See Also

Date Function

Date Statement

Day Function

Hour Function

Minute Function

Month Function

Second Function

Time Function

Time Statement

Weekday Function

Year Function


Second Function

See Also

Returns a whole number between 0 and 59, inclusive, representing the second of the minute.

Syntax

Second(time)

The time argument is any numeric or string expression, or any combination, that can represent a time.  If time contains Null, Null is returned.


 See Also

Day Function

Hour Function

Minute Function

Now Function

Time Function

Time Statement


Time Function

See Also

Returns a Date indicating the current system time.

Syntax

Time

Remarks

To set the system time, use the Time statement.


 See Also

Date Function

Date Statement

Time Statement

Timer Function


Time Statement

See Also

Sets the system time.

Syntax

Time = time

The time argument is any numeric or string expression, or any combination, that can represent a time.

Remarks

If time is a string, Time attempts to convert it to a time using the time separators you specified for your system.  If it can't be converted to a valid time, an error occurs.

Note   If you use the Time statement to set the time on computers using versions of MS-DOS earlier than version 3.3, the change remains in effect only until you change it again or turn off your computer.  Many computers have a battery-powered CMOS RAM that retains date and time information when the computer is turned off.  However, to permanently change the time on computers running earlier versions of MS-DOS, you may have to use your Setup disk or perform some equivalent action.  Refer to the documentation for your particular system.


 See Also

Date Function

Date Statement

Time Function


Timer Function

See Also

Returns the number of seconds elapsed since midnight.

Syntax

Timer


 See Also

Time Function


TimeSerial Function

See Also

Returns a Date containing the time for a specific hour, minute, and second.

Syntax

TimeSerial(hour, minute, second)

The TimeSerial function syntax has these named 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 normally accepted range for the unit; that is, 0 [image] 23 for hours and 0 [image] 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 TimeSerial function returns 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 normally 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.


 See Also

DateSerial Function

DateValue Function

Hour Function

Minute Function

Now Function

Second Function

TimeValue Function


TimeValue Function

See Also

Returns a Date containing the time.

Syntax

TimeValue(time)

The time argument is normally 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- 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 it.  However, if time includes invalid date information, an error occurs.


 See Also

DateSerial Function

DateValue Function

Hour Function

Minute Function

Now Function

Second Function

TimeSerial Function


Weekday Function

See Also

Returns a whole number representing the day of the week.

Syntax

Weekday(date, [firstdayofweek])

The Weekday function syntax has these named arguments:

Part	Description

date	Numeric or string expression, in any combination, that can represent a date.  If date contains Null, Null is returned.

firstdayofweek	A constant that specifies the first day of the week, as described in Settings.  If omitted, vbSunday is assumed.

Settings

The firstdayofweek argument has these settings:

Constant	Value	Description

vbUseSystem	0	Use 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 function 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


 See Also

Date Function

Date Statement

Day Function

Month Function

Now Function

Year Function


Year Function

See Also

Returns a whole number representing the year.

Syntax

Year(date)

The date argument is any numeric or string expression, or any combination, that can represent a date.  If date contains Null, Null is returned.


 See Also

Date Function

Date Statement

Day Function

Month Function

Now Function

Weekday Function


Close Statement

See Also

Concludes input/output (I/O) to a file opened using the Open statement.

Syntax

Close [filenumberlist]

The filenumberlist argument can be one or more file numbers using the following syntax, where filenumber is any valid file number:

[[#]filenumber][, [#]filenumber] . . .

Remarks

If you omit filenumberlist, all active files opened by the Open statement are closed.

When you close files that were opened for Output or Append, the final buffer of output is written to the operating system buffer for that file.  All buffer space associated with the closed file is released.

When the Close statement is executed, the association of a file with its file number ends.


 See Also

End Statement

Open Statement

Reset Statement

Stop Statement


EOF Function

See Also

Returns a value that indicates whether the end of a file has been reached.

Syntax

EOF(filenumber)

The filenumber argument is any valid file number.

Remarks

Use EOF to avoid the error generated by the attempt to get input past the end of a file.

The EOF function returns False unless the end of the file has been reached; then it returns True.  When used with files opened for Random or Binary access, EOF returns False unless the last executed Get statement is unable to read an entire record; then it returns True.


 See Also

Get Statement

Input # Statement

Loc Function

LOF Function

Open Statement


FileAttr Function

See Also

Returns file mode or operating system file handle information for files opened using the Open statement.

Syntax

FileAttr(filenumber, returntype)

The FileAttr function syntax has these named arguments:

Part	Description

filenumber	Any valid file number.

returntype	Number indicating the type of information to return.  Specify 1 to return a value indicating the file mode.  Specify 2 to return the operating system file handle.

Return Values

When the returntype argument is 1, the following return values indicate the file access mode:

Value	File Mode

1	Input

2	Output

4	Random

8	Append

32	Binary


 See Also

Open Statement


FreeFile Function

See Also

Returns the next file number available for use by the Open statement.

Syntax

FreeFile[(rangenumber)]

The rangenumber argument specifies the range from which the next free file number is to be returned.  Specify a 0 (default) to return a file number in the range 1 to 255, inclusive.  Specify a 1 to return a file number in the range 256 to 511.

Remarks

Use FreeFile when you have to supply a file number and you want to make sure the file number is not already in use.


 See Also

Open Statement


Get Statement

See Also

Reads from an open disk file into a variable.

Syntax

Get [#]filenumber, [recnumber], varname

The Get statement syntax has these parts:

Part	Description

filenumber	Any valid file number.

recnumber	Record number (Random mode files) or byte number (Binary mode files) at which reading begins.

varname	Valid variable name into which data is read.

Remarks

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 (the one after the last Get or Put statement or the one pointed to by the last Seek function) is read.  Delimiting commas must be included, for example:

Get #4,,FileBuffer

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 still 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 can't 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 variable-length string, Get reads a 2-byte descriptor containing the string length and then the data that goes into the variable.  Therefore, the record length specified by the Len clause in the Open statement must be at least 2 bytes greater than the actual length of the string.

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.

Note   You can use the Get statement to read a Variant array from disk but you can't use Get to read a scalar Variant containing an array.  You also can't use Get to read objects from disk.

If the variable being read into is a String Variant (VarType 8), Get reads 2 bytes identifying the VarType, 2 bytes indicating the length of the string, and then 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 example, the following array declaration requires 118 bytes when the array is written to disk.

Dim MyArray(1 To 5,1 To 10) As Integer

The 118 bytes are distibuted as follows:  18 bytes for the descriptor (2 + 8 * 2), and 100 bytes for the data (5 * 10 * 2).

If the variable being read into is a fixed-size array, Get reads only the data.  No descriptor is read.

If the variable being read into is any other type of variable (not a variable-length string or a Variant), Get reads only the variable data.  The record length specified by the Len clause in the Open statement must be greater than or equal to the length of the data being read.

Get reads elements of user-defined types as if each were being read individually, except that there is no padding between elements  On disk, a dynamic array in a user-defined type (written with Put) is prefixed by 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 individual elements, including any arrays and their descriptors.

For files opened in Binary mode, all of the Random rules apply, except:

In Binary mode, the Len clause in the Open statement has no effect.  Get reads all variables from disk contiguously; that is, with no padding between records.

For any array other than an array in a user-defined type, Get reads only the data.  No descriptor is read.

Get reads variable-length strings that aren't elements of user-defined types without expecting the 2-byte length descriptor.  The number of bytes read equals the number of characters already in the string.  For example, the following statements read 10 bytes from file number 1:

VarString = String(10," ")

Get #1,,VarString


 See Also

Input # Statement

Line Input # Statement

Open Statement

Put Statement

Seek Function


Input # Statement

See Also

Reads data from an open sequential file and assigns the data to variables.

Syntax

Input #filenumber, varlist

The Input # statement syntax has these parts:

Part	Description

filenumber	Any valid file number.

varlist	Comma-delimited list of variables that are assigned values read from the file [image] can't be an array or object variable.  However, variables that describe an element of an array or user-defined type may be used.

Remarks

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.

Data items in a file must appear in the same order as the variables in varlist and match variables of the same data type.  If a variable is numeric and the data is not, a value of zero is assigned to the variable.

If the end of the file is reached while a data item is being input, the input is terminated and an error occurs.

Note   To correctly read data from a file into variables, you should always use the Write # statement instead of the Print # statement to write the data to the files.  Using Write # ensures that each separate data field is properly delimited.


 See Also

Input Function

Open Statement

Print # Statement

Write # Statement


Input Function

See Also

Returns characters from an open sequential or binary file.

Syntax

Input(number, [#]filenumber)

The Input function syntax has these parts:

Part	Description

number	Any valid numeric expression specifying the number of characters to return.

filenumber	Any valid file number.

Remarks

Use this function only with files opened in Input or Binary mode.

Unlike the Input # statement, the Input function returns all of the characters it reads, including commas, carriage returns, linefeeds, quotation marks, and leading spaces.

Note   Another function (InputB) is provided for use with byte data contained within text files.  Instead of specifying the number of characters to return, number specifies the number of bytes.


 See Also

Get Statement

Input # Statement


Line Input # Statement

See Also

Reads a line from an open sequential file and assigns it to a string variable.

Syntax

Line Input #filenumber, varname

The Line Input # statement syntax has these parts:

Part	Description

filenumber	Any valid file number.

varname	Valid string variable name.

Remarks

The Line Input # 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.


 See Also

Chr Function

Input # Statement


Loc Function

See Also

Returns the current read/write position within an open file.

Syntax

Loc(filenumber)

The filenumber argument is any valid file number.

Remarks

The following describes the return value for each file access mode:

File Access	Return Value

Random	Number of the last record read from or written to the file.

Sequential	Current byte position in the file divided by 128.  (Note that information returned by Loc for sequential files is neither used nor required.)

Binary	Position of the last byte read or written.


 See Also

EOF Function

LOF Function

Open Statement


Lock, Unlock Statements

See Also

Controls access by other processes to all or part of a file opened using the Open statement.

Syntax

Lock [#]filenumber[, recordrange]
. . .
Unlock [#]filenumber[, recordrange]

The Lock and Unlock statement syntax has these parts:

Part	Description

filenumber	Any valid file number.

recordrange	The range of records to lock or unlock.

Settings

The recordrange argument settings are:

recnumber | [start] To end

Setting	Description

recnumber	Record number (Random mode files) or byte number (Binary mode files) at which locking or unlocking begins.

start	Number of the first record or byte to lock or unlock.

end	Number of the last record or byte to lock or unlock.

Remarks

The Lock and Unlock statements are used in environments where several processes might need access to the same file.

Lock and Unlock statements are always used in pairs.  The arguments to Lock and Unlock must match exactly.

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 specify just one record, then only that record is locked or unlocked.  If you specify a range of records and omit a starting record (start), all records from the first record to the end of the range (end) are locked or unlocked. Using Lock without recnumber locks the entire file; using Unlock without recnumber unlocks the entire file.

If the file has been opened for sequential input or output, Lock and Unlock affect the entire file, regardless of the range specified by start and end.

Caution   Be sure to remove all locks with an Unlock statement before closing a file or quitting your program.  Failure to remove locks produces unpredictable results.


 See Also

Open Statement


LOF Function

See Also

Returns the size, in bytes, of a file opened using the Open statement.

Syntax

LOF(filenumber)

The filenumber argument is any valid file number.

Remarks

To obtain the length of a file that is not open, use the FileLen function.


 See Also

EOF Function

Loc Function

Open Statement


Open Statement

See Also

Enables input/output (I/O) to a file.

Syntax

Open pathname [For mode] [Access access] [lock] As [#]filenumber [Len=reclength]

The Open statement syntax has these parts:

Part	Description

pathname	String expression that specifies a filename [image] may include directory and drive.

mode	Keyword specifying the file mode: Append, Binary, Input, Output, or Random.

access	Keyword specifying the operations permitted on the open file: Read, Write, or Read Write.

lock	Keyword specifying the operations permitted on the open file by other processes: Shared, Lock Read, Lock Write, and Lock Read Write.

filenumber	A valid file number in the range 1 to 511, inclusive.  Use the FreeFile function to obtain the next available file number.

reclength	Number less than or equal to 32,767 (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

You must open a file before any I/O operation can be performed on it.  Open allocates a buffer for I/O to the file and determines the mode of access to use with the buffer.

If the file specified by pathname doesn't exist, it is created when a file is opened for Append, Binary, Output, or Random modes.

If the file is already opened by another process and the specified type of access is not allowed, the Open operation fails and an error occurs.

The Len clause is ignored if mode is Binary.

Important   In Binary, Input, and Random modes, you can open a file using a different file number without first closing the file.  In Append and Output modes, you must close a file before opening it with a different file number.


 See Also

Close Statement

FreeFile Function


Print # Statement

See Also

Writes display-formatted data to a sequential file.

Syntax

Print #filenumber, [outputlist]

The Print # statement syntax has these parts:

Part	Description

filenumber	Any valid file number.

outputlist	Expression or list of expressions to print.

Settings

The outputlist argument settings are:

[{Spc(n) | Tab[(n)]}][expression][charpos]

Setting	Description

Spc(n)	Used to insert space characters in the output, where n is the number of space characters to insert.

Tab(n)	Used to position the insertion point to an absolute column number, where n is the column number.  Use Tab with no argument to position the insertion point at the beginning of the next print zone.

expression	Numeric or string expressions to print.

charpos	Specifies the insertion point for the next character.  Use a semicolon to specify the insertion point to be immediately after the last character displayed.  Use Tab(n) to position the insertion point to an absolute column number.  Use Tab with no argument to position the insertion point at the beginning of the next print zone.  If charpos is omitted, the next character is printed on the next line.

Remarks

If you omit outputlist and include only a list separator after filenumber, a blank line is printed to the file.  Multiple expressions can be separated with either a space or a semicolon.  A space has the same effect as a semicolon.

All data written to the file using Print # is internationally aware; that is, the data is properly formatted (using the appropriate decimal separator) and the keywords are written in the language appropriate for the locale specified for your system.

For Boolean data, either True or False is printed.  The True and False keywords are translated, as appropriate, according to the locale setting specified for your system.

Date data is written to the file using the standard short date format recognized by your system.  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 outputlist data is Empty.  However, if outputlist data is Null, Null is written to the file.  Again, the Null keyword is translated, as appropriate.

For Error data, the output appears as Error errorcode.  The Error keyword is translated, as appropriate, when written to the file.

Because Print # writes an image of the data to the file, you must delimit the data so it prints correctly.  If you use Tab with no arguments to move the print position to the next print zone, Print # also writes the spaces between print fields to the file.

Note   If, at some future time, you want to read the data from a file using the Input # statement, use the Write # statement instead of the Print # statement to write the data to the file.  Using Write # ensures the integrity of each separate data field by properly delimiting it, so that it can be read back in using Input #.  Using Write # also ensures that it can be correctly read in any locale.


 See Also

Open Statement

Print Method

Spc Function

Tab Function

Write # Statement


Put Statement

See Also

Writes from a variable to a disk file.

Syntax

Put [#]filenumber, [recnumber], varname

The Put statement syntax has these parts:

Part	Description

filenumber	Any valid file number.

recnumber	Record number (Random mode files) or byte number (Binary mode files) at which writing begins.

varname	Name of variable containing data to be written to disk.

Remarks

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 (the one after the last Get or Put statement or the one pointed to by the last Seek function) is written.  You must include delimiting commas, for example:

Put #4,,FileBuffer

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 still 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 can't 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 that specified in the Len clause of the Open statement, an error occurs.

If the variable being written is a variable-length string, Put writes a 2-byte descriptor containing the string length and then the variable.  The record length specified by the Len clause in the Open statement must be at least 2 bytes greater than the actual length of the string.

If the variable being written is a Variant of a numeric type, Put writes 2 bytes identifying the VarType of the Variant and then 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.

Note   You can use the Put statement to write a Variant array to disk but you can't use Put to write a scalar Variant containing an array to disk.  You also can't use Put to write objects to disk.

If the variable being written is a String Variant (VarType 8), Put writes 2 bytes identifying the VarType, 2 bytes indicating the length of the string, and then 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.

Dim MyArray(1 To 5,1 To 10) As Integer

The 118 bytes are distibuted as follows:  18 bytes for the descriptor (2 + 8 * 2), and 100 bytes for the data (5 * 10 * 2).

If the variable being written is a fixed-size array, Put writes only the data.  No descriptor is written to disk.

If the variable being written is any other type of variable (not a variable-length string or a Variant), Put writes only the variable data.  The record length specified by the Len clause in the Open statement must be greater than or equal to the length of the data being written.

Put writes elements of user-defined types as if each were written individually, except there is no padding between elements. On disk, a dynamic array in a user-defined type written with Put is prefixed by 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 individual elements, including any arrays and their descriptors.

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.

For any array other than an array in a user-defined type, Put writes only the data.  No descriptor is written.

Put writes variable-length strings that are not elements of user-defined types without the 2-byte length descriptor.  The number of bytes written equals the number of characters in the string.  For example, the following statements write 10 bytes to file number 1:

VarString$ = String$(10," ")

Put #1,,VarString$


 See Also

Get Statement

Open Statement

Seek Function


Reset Statement

See Also

Closes all disk files opened using the Open statement.

Syntax

Reset

Remarks

The Reset statement syntax closes all active files opened by the Open statement and writes the contents of all file buffers to disk.


 See Also

Close Statement

End Statement

Open Statement


Seek Function

See Also

Returns the current read/write position within a file opened using the Open statement.

Syntax

Seek(filenumber)

The filenumber argument is any valid file number.

Remarks

Seek returns a value between 1 and 2,147,483,647 (equivalent to 2^31 - 1), inclusive.  For files open in Random mode, Seek returns the number of the next record read or written.  For files opened in Binary, Output, Append, or Input mode, Seek returns the byte position at which the next operation is to take place.  The first byte in a file is at position 1, the second byte is at position 2, and so on.


 See Also

Get Statement

Open Statement

Put Statement

Seek Statement


Seek Statement

See Also

Sets the position for the next read or write within a file opened using the Open statement.

Syntax

Seek [#]filenumber, position

The Seek statement syntax has these parts:

Part	Description

filenumber	Any valid file number.

position	Number in the range 1 to 2,147,483,647, inclusive, that indicates where the next read or write should occur.

Remarks

Record numbers specified in Get and Put statements override file positioning performed by Seek.

Performing a file write after doing a Seek operation beyond the end of a file extends the file.  If you attempt a Seek operation to a negative or zero position, an error occurs.


See Also

Get Statement

Open Statement

Put Statement

Seek Function


Spc Function

See Also

Used with the Print # statement or the Print method to position output.

Syntax

Spc(n)

The n argument is the number of spaces to insert before displaying or printing the next expression in a list.

Remarks

If n is less than the output-line width, the next print position immediately follows the number of spaces printed.  If n is greater than the output-line width, Spc calculates the next print position using the formula:

currentprintposition + (n Mod width)

For example, if the current print position is 24, and the output-line width is 80 and you specify Spc(90), the next print will start at position 34 (current print position + the remainder of 90/80).  If the difference between the current print position and the output-line width is less than n (or n Mod width), the Spc function skips to the beginning of the next line and generates a number of spaces equal to n - (width - currentprintposition).

Note   Make sure your tabular columns are wide enough to accommodate wide letters.

When you use the Print method with a proportionally spaced font, the width of space characters printed using the Spc function is always an average of the width of all characters in the point size for the chosen font.  However, there is no correlation between the number of characters printed and the number of fixed-width columns those characters occupy.  For example, the uppercase letter W occupies more than one fixed-width column and the lowercase letter I occupies less.


 See Also

Mod Operator

Print Method

Print # Statement

Space Function

Tab Function

Width # Statement


Tab Function

See Also

Used with the Print # statement or the Print method to position output.

Syntax

Tab[(n)]

The n argument is the column number to tab to before displaying or printing the next expression in a list.  If omitted, Tab moves the cursor to the beginning of the next print zone.  This allows Tab to be used instead of a comma in locales where the comma is used as a decimal separator.

Remarks

If the current print position on the current line is greater than n, Tab skips to the nth column on the next output line.  If n is less than 1, Tab moves the print position to column 1.  If n is greater than the output-line width, Tab calculates the next print position using the formula:

n Mod width

For example, if width is 80 and you specify Tab(90), the next print will start at column 10 (the remainder of 90/80).  If n is less than the current print position, printing begins on the next line at the calculated print position.  If the calculated print position is greater than the current print position, printing begins at the calculated print position on the same line.

The leftmost print position on an output line is always 1.  When you use the Print # statement to print to files, the rightmost print position is the current width of the output file, which you can set using the Width # statement.

Note   Make sure your tabular columns are wide enough to accommodate wide letters.

When you use the Tab function with the Print method, the print surface is divided into uniform, fixed-width columns.  The width of each column is an average of the width of all characters in the point size for the chosen font.  However, there is no correlation between the number of characters printed and the number of fixed-width columns those characters occupy.  For example, the uppercase letter W occupies more than one fixed-width column and the lowercase letter I occupies less.


 See Also

Mod Operator

Print Method

Print # Statement

Space Function

Spc Function

Width # Statement


Width # Statement

See Also

Assigns an output-line width to a file opened using the Open statement.

Syntax

Width #filenumber, width

The Width statement syntax has these parts:

Part	Description

filenumber	Any valid file number.

width	Numeric expression in the range 0 to 255, inclusive, that indicates how many characters appear on a line before a new line is started.  If width equals 0, there is no limit to the length of a line.  The default value for width is 0.


 See Also

Open Statement

Print # Statement


Write # Statement

See Also

Writes raw data to a sequential file.

Syntax

Write #filenumber, [outputlist]

The Write statement syntax has these parts:

Part	Description

filenumber	Any valid file number.

outputlist	One or more comma-delimited numeric or string expressions to write to a file.

Remarks

If you omit outputlist and include a comma after filenumber, a blank line is printed to the file.  Multiple expressions can be separated with a space, a semicolon, or a comma.  A space has the same effect as a semicolon.

When Write # is used to write data to a file, several universal assumptions are followed so the data can always be read and correctly interpreted using Input #, 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 outputlist data is Empty.  However, for Null data, #NULL# is written.

For Error data, the output appears as #ERROR errorcode#.  The Error keyword is not translated, regardless of locale.

Unlike the Print # statement, the Write # statement inserts commas between items and quotation marks around strings as they are written to the file.  You don't have to put explicit delimiters in the list.  Write # inserts a newline character, that is, a carriage return (Chr(13)) or carriage return-linefeed (Chr(13) + Chr (10)), after it has written the final character in outputlist to the file.


 See Also

Chr Function

Input # Statement

Open Statement

Print # Statement


Character Set (0 - 127)

 0	 32	[space] 	 64	@	 96	`

 1	 33	!	 65	A	 97	a

 2	 34	"	 66	B	 98	b

 3	 35	#	 67	C	 99	c

 4	 36	$	 68	D	 100	d

 5	 37	%	 69	E	 101	e

 6	 38	&	 70	F	 102	f

 7	 39	'	 71	G	 103	g

 8	* *	 40	(	 72	H	 104	h

 9	* *	 41	)	 73	I	 105	i

 10	* *	 42	*	 74	J	 106	j

 11	 43	+	 75	K	 107	k

 12	 44	,	 76	L	 108	l

 13	* *	 45	-	 77	M	 109	m

 14	 46	.	 78	N	 110	n

 15	 47	/	 79	O	 111	o

 16	 48	0	 80	P	 112	p

 17	 49	1	 81	Q	 113	q

 18	 50	2	 82	R	 114	r

 19	 51	3	 83	S	 115	s

 20	 52	4	 84	T	 116	t

 21	 53	5	 85	U	 117	u

 22	 54	6	 86	V	 118	v

 23	 55	7	 87	W	 119	w

 24	 56	8	 88	X	 120	x

 25	 57	9	 89	Y	 121	y

 26	 58	:	 90	Z	 122	z

 27	 59	;	 91	[	 123	{

 28	 60	<	 92	\	 124	|

 29	 61	=	 93	]	 125	}

 30	 62	>	 94	^	 126	~

 31	 63	?	 95	_	 127

* *	Values 8, 9, 10, and 13 convert to backspace, tab, linefeed, and carriage return characters, respectively.  They have no graphical representation, but depending on the application, may affect the visual display of text.

These characters aren't supported by Microsoft Windows.


CreateObject Function

See Also

Creates an OLE Automation object.

Syntax

CreateObject(class)

The class argument uses the syntax "appname.objecttype" and has these parts:

Part	Description

appname	The name of the application providing the object.

objecttype	The type or class of object to create.

Remarks

Every application that supports OLE Automation provides at least one type of object.  For example, a word processing application may provide an application object, a document object, and a toolbar object.

To create an OLE Automation object, assign the object returned by CreateObject to an object variable:

Dim WordBasicObject As Object

Set WordBasicObject = CreateObject("Word.Basic")

When this code is executed, the application creating the object is started (Microsoft Word in this example).  If it is already running, a new instance of the application is started, and an object of the specified type is created.  Once an object is created, you reference it in code using the object variable you defined.  In the above example, you access properties and methods of the new object using the object variable, WordBasicObject.  For example:

WordBasicObject.Insert "Hello, world."

WordBasicObject.FilePrint

WordBasicObject.FileSaveAs "C:\DOCS\TEST.DOC"

Similarly, you can pass the object returned by the CreateObject function to a function expecting an object as an argument.  For example:

Call MySub (CreateObject("Word.Basic"))

Note   Use CreateObject when there is no current instance of the object. If there is a current instance, or if you want to start the application and have it load a file, you can use the GetObject function.

If an object has registered itself as a single-instance object (for example, the Word.Basic object in Microsoft Word 6.0), only one instance of the object is created, no matter how many times CreateObject is executed.


 See Also

GetObject Function


GetObject Function

See Also

Retrieves an OLE Automation object from a file.

Syntax

GetObject([pathname][, class])

The GetObject function syntax has these named arguments:

Part	Description

pathname	The full path and name of the file containing the object to retrieve.  If pathname is omitted, class is required.

class	A string representing the class of the object.

The class argument uses the syntax "appname.objecttype" and has these parts:

Part	Description

appname	The name of the application providing the object.

objecttype	The type or class of object to create.

Remarks

Use the GetObject function to access an OLE Automation object from a file and assign the object to an object variable.  To do this, use the Set statement to assign the object returned by GetObject to the object variable.  For example:

Dim CADObject As Object

Set CADObject = GetObject("C:\CAD\SCHEMA.CAD")

When this code is executed, the application associated with the specified pathname is started and the object in the specified file is activated.

If pathname is a zero-length string (""), GetObject returns a new object instance of the specified type.  If the pathname argument is omitted entirely, GetObject returns a currently active object of the specified type.  If no object of the specified type exists, an error occurs.

The above example shows how to activate an entire file.  However, some applications allow you to activate part of a file.  To do this, add an exclamation point (!) to the end of the filename and follow it with a string that identifies the part of the file you want to activate.  For information on how to create this string, see the documentation for the application that created the object.

For example, in a drawing application you might have multiple layers to a drawing stored in a file.  You could use the following code to activate a layer within a drawing called SCHEMA.CAD:

Set LayerObject = GetObject("C:\CAD\SCHEMA.CAD!Layer3")

If you do not specify the object's class, based on the filename you provide, OLE determines the application to start and the object to activate.  Some files, however, may support more than one class of object.  For example, a drawing might support three different types of objects: an application object, a drawing object, and a toolbar object, all of which are part of the same file.  To specify which object in a file you want to activate, use the optional class argument.  For example:

Dim MyObject As Object

Set MyObject = GetObject("C:\DRAWINGS\SAMPLE.DRW", "FIGMENT.DRAWING")

In the above example, FIGMENT is the name of a drawing application and DRAWING is one of the object types it supports.

Once an object is activated, you reference it in code using the object variable you defined.  In the above example, you access properties and methods of the new object using the object variable MyObject.  For example:

MyObject.Line 9, 90

MyObject.InsertText 9, 100, "Hello, world."

MyObject.SaveAs "C:\DRAWINGS\SAMPLE.DRW"

Note   Use the GetObject function when there is a current instance of the object, or if you want to create the object with a file already loaded. If there is no current instance, and you don't want the object started with a file loaded, use the CreateObject function.

If an object has registered itself as a single-instance object (for example, the Word.Basic object in Microsoft Word 6.0), only one instance of the object is created, no matter how many times CreateObject is executed.  In addition, with a single-instance object, GetObject always returns the same instance when called with the zero-length string syntax (""), and it causes an error if the pathname argument is omitted.  You can't use GetObject to obtain a reference to a class created with Visual Basic.


 See Also

CreateObject Function


Visual Basic for Applications Constants

See Also

Visual Basic for applications defines constants to simplify your programming.  The following constants can be used anywhere in your code in place of the actual values:

Compiler Constants

Date Constants

Dir, GetAttr, and SetAttr Constants

IMEStatus Constants

MsgBox Constants

Shell Constants

StrConv Constants

VarType Constants


See Also

Format Function

IMEStatus Function

MsgBox Function

Shell Function

StrConv Function

Weekday Function


Compiler Constants

See Also

Visual Basic for applications defines constants for exclusive use with the #If...Then...#Else directive.  These constants are functionally equivalent to constants defined with the #Const directive except that they are global in scope; that is, they apply everywhere in a project.

On 16-bit development platforms, the compiler constants are defined as follows:

Constant	Value	Description

Win16	True	Indicates that the development environment is 16-bit.

Win32	False	Indicates that the development environment is not 32-bit.

On 32-bit development platforms, the compiler constants are defined as follows:

Constant	Value	Description

Win16	False	Indicates that the development environment is not 16-bit.

Win32	True	Indicates that the development environment is 32-bit.

Note   Because the constants defined here are provided by Visual Basic, you can't define your own constants at any level with these same names.


See Also

Visual Basic for Applications Constants


VarType Constants

See Also

Constant	Value	Description

vbEmpty	0	Uninitialized (default).

vbNull	1	Contains 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	OLE Automation object.

vbError	10	Error.

vbBoolean	11	Boolean.

vbVariant	12	Variant (used only for arrays of Variants).

vbDataObject	13	Non-OLE Automation object.

vbByte	17	Byte

vbArray	8192	Array.


See Also

Visual Basic for Applications Constants


MsgBox Constants

See Also

MsgBox Arguments

Constant	Value	Description

vbOKOnly	0	OK button only (default).

vbOKCancel	1	OK and Cancel buttons.

vbAbortRetryIgnore	2	Abort, Retry, and Ignore buttons.

vbYesNoCancel	3	Yes, No, and Cancel buttons.

vbYesNo	4	Yes and No buttons.

vbRetryCancel	5	Retry and Cancel buttons.

vbCritical	16	Critical message.

vbQuestion	32	Warning query.

vbExclamation	48	Warning message.

vbInformation	64	Information message.

vbDefaultButton1	0	First button is default (default).

vbDefaultButton2	256	Second button is default.

vbDefaultButton3	512	Third button is default.

vbApplicationModal	0	Application modal message box (default).

vbSystemModal	4096	System modal message box.

MsgBox Return Values

Constant	Value	Description

vbOK	1	OK button pressed.

vbCancel	2	Cancel button pressed.

vbAbort	3	Abort button pressed.

vbRetry	4	Retry button pressed.

vbIgnore	5	Ignore button pressed.

vbYes	6	Yes button pressed.

vbNo	7	No button pressed.


See Also

MsgBox Function

Visual Basic for Applications Constants


Date Constants

See Also

firstdayofweek Argument Values

Constant	Value	Description

vbUseSystem	0	Use NLS API setting.

vbSunday	1	Sunday

vbMonday	2	Monday

vbTuesday	3	Tuesday

vbWednesday	4	Wednesday

vbThursday	5	Thursday

vbFriday	6	Friday

vbSaturday	7	Saturday

firstweekofyear Argument Values

Constant	Value	Description

vbUseSystem	0	Use application setting if one exists; otherwise use NLS API setting.

vbFirstJan1	1	Start with week in which January 1 occurs (default)

vbFirstFourDays	2	Start with the first week that has at least four days in the new year.

vbFirstFullWeek	3	Start with the first full week of the year.

Return 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


See Also

Format Function

Weekday Function

Visual Basic for Applications Constants


Dir, GetAttr, and SetAttr Constants

See Also

Constant	Value	Description

vbNormal	0	Normal (default for Dir and SetAttr).

vbReadOnly	1	Read-only.

vbHidden	2	Hidden.

vbSystem	4	System file.

vbVolume	8	Volume label.

vbDirectory	16	Directory.

vbArchive	32	File has changed since last backup.


See Also

Visual Basic for Applications Constants


IMEStatus Constants

See Also

Japanese locale:

Constant	Value	Description

vbIMENoOp	0	No IME installed.

vbIMEOn	1	IME on.

vbIMEOff	2	IME off.

vbIMEDisable	3	IME disabled.

vbIMEHiragana	4	Hiragana double-byte characters (DBC)

vbIMEKatakanaDbl	5	Katakana DBC.

vbIMEKatakanaSng	6	Katakana single-byte characters (SBC).

vbIMEAlphaDbl	7	Alphanumeric DBC.

vbIMEAlphaSng	8	Alphanumeric SBC.

Chinese (traditional and simplified) locale:

Constant	Value	Description

vbIMENoOp	0	No IME installed.

vbIMEOn	1	IME on.

vbIMEOff	2	IME off.

Korean locale [image] examine the first five bits of the return value, which are set as follows:

Bit	Value	Description	Value	Description
0	0	No IME installed.	1	IME installed.
1	0	IME disabled.	1	IME enabled.
2	0	IME English mode.	1	Hangeul mode.
3	0	Banja mode (SB).	1	Junja mode (DB).
4	0	Normal mode.	1	Hanja conversion mode.


See Also

IMEStatus Function

Visual Basic for Applications Constants


Shell Constants

See Also

Constant	Value	Description

vbHide	0	Window is hidden and focus is passed to the hidden window.

vbNormalFocus	1	Window has focus and is restored to its original size and position.

vbMinimizedFocus	2	Window is displayed as an icon with focus.

vbMaximizedFocus	3	Window is maximized with focus.

vbNormalNoFocus	4	Window is restored to its most recent size and position.  The currently active window remains active.

vbMinimizedNoFocus	6	Window is displayed as an icon.  The currently active window remains active.


See Also

Shell Function

Visual Basic for Applications Constants


StrConv Constants

See Also

Constant	Value	Description

vbUpperCase	1	Uppercases the string.

vbLowerCase	2	Lowercases the string.

vbProperCase	3	Uppercases first letter of every word in string.

vbWide*	4*	Converts narrow (single-byte) characters in string to wide (double-byte) characters.

vbNarrow*	8*	Converts wide (double-byte) characters in string to narrow (single-byte) characters.

vbKatakana**	16**	Converts Hiragana characters in string to Katakana characters.

vbHiragana**	32**	Converts Katakana characters in string to Hiragana characters.

vbUnicode***	64***	Converts the string to Unicode using the default code page of the system.

vbFromUnicode***	128***	Converts the string from Unicode to the default code page of the system.

*	Applies to Far East locales.

**	Applies to Japan only.

***	Specifying this bit on 16-bit systems causes a run-time error.


See Also

StrConv Function

Visual Basic for Applications Constants


IMEStatus Function

Returns the current Input Method Editor (IME) mode; available in Far East versions only.

Syntax

IMEStatus

Return Values

Japanese locale:

Constant	Value	Description

vbIMENoOP	0	No IME installed.

vbIMEOn	1	IME on.

vbIMEOff	2	IME off.

vbIMEDisable	3	IME disabled.

vbIMEHiragana	4	Hiragana double-byte characters (DBC).

vbIMEKatakanaDbl	5	Katakana DBC.

vbIMEKatakanaSng	6	Katakana single-byte characters (SBC).

vbIMEAlphaDbl	7	Alphanumeric DBC.

vbIMEAlphaSng	8	Alphanumeric SBC.

Chinese (traditional and simplified) locale:

Constant	Value	Description

vbIMENoOP	0	No IME installed.

vbIMEOn	1	IME on.

vbIMEOff	2	IME off.

Korean locale [image] examine the first five bits of the return, which are set as follows:

Bit	Value	Description	Value	Description
0	0	No IME installed.	1	IME installed.
1	0	IME disabled.	1	IME enabled.
2	0	IME English mode.	1	Hangeul mode.
3	0	Banja mode (SB).	1	Junja mode (DB).
4	0	Normal mode.	1	Hanja conversion mode.


StrConv Function

See Also

Returns a converted string.

Syntax

StrConv(string, conversion)

The StrConv function syntax has these named arguments:

Part	Description

string	The string expression to be converted.

conversion	The sum of values specifying the type of conversion to perform.

Settings

The conversion argument settings are:

Constant	Value	Description

vbUpperCase	1	Converts the string to uppercase characters.

vbLowerCase	2	Converts the string to lowercase characters.

vbProperCase	3	Converts the first letter of every word in string to uppercase.

vbWide*	4*	Converts narrow (single-byte) characters in string to wide (double-byte) characters.

vbNarrow*	8*	Converts wide (double-byte) characters in string to narrow (single-byte) characters.

vbKatakana**	16**	Converts Hiragana characters in string to Katakana characters.

vbHiragana**	32**	Converts Katakana characters in string to Hiragana characters.

vbUnicode***	64***	Converts the string to Unicode using the default code page of the system.

vbFromUnicode***	128***	Converts the string from Unicode to the default code page of the system.

*	Applies to Far East locales.

**	Applies to Japan only.

***	Specifying this bit on 16-bit systems causes a run-time error.

Note   These constants are specified by Visual Basic for applications.  As a result, they can be used anywhere in your code in place of the actual values.  Most can be combined (for example vbUpperCase + vbWide) except when they are mutually exclusive (for example vbUnicode + vbFromUnicode).  The constants vbWide, vbNarrow, vbKatakana, and vbHiragana cause run-time errors when used in locales where they don't apply.

For proper casing the following are valid word separators:  Null (Chr$(0)), horizontal tab (Chr$(9)), linefeed (Chr$(10)), vertical tab (Chr$(11)), form feed (Chr$(12)), carriage return (Chr$(13)), space (SBCS) (Chr$(32)).  The actual value for a space varies by country for DBCS.


See Also

Chr Function


Document Conventions

Visual Basic documentation uses the following typographic conventions.

Convention	Description

Sub, Font, BackColor, True	Words in bold with initial letter capitalized indicate language-specific keywords.

setup	Words you are instructed to type appear in bold.

object, varname, arglist	Italic, lowercase letters indicate placeholders for information you supply.

pathname, filenumber	Bold, italic, and lowercase letters indicate placeholders for arguments where you can use either positional or named-argument syntax.

[expressionlist]	In syntax, items inside square brackets are optional.

{While | Until}	In syntax, braces and a vertical bar indicate a mandatory choice between two or more items.  You must choose one of the items unless all of the items are also enclosed in square brackets.  For example:

[{This | OrThat}]

VBA.INI, ESC, ENTER	Words in all capital letters indicate filenames, key names, and key sequences.

ALT+F1, CTRL+R	A plus sign (+) between key names indicates a combination of keys.  For example, ALT+F1 means to hold down the ALT key while pressing the F1 key.

MyString = "Hello, world!"	This font is used for code, variables, and error message text.

' This is a comment.	An apostrophe (') introduces code comments.

MyVar = "This is an " _	A space and an underscore (_) continues a line of code.

& "example" _

& " of how to continue code."


Collection Object Methods (Object Browser)

The Collection object module displays procedures used to perform collection operations.

To get Help on a particular method

1.	Select the procedure from the Methods/Properties list box.

2.	Choose the [image] button.


Constants (Object Browser)

See Also

The Constants module in the Visual Basic for applications object library displays the predefined constants used with the Dir, GetAttr, IMEStatus, MsgBox, StrConv, and VarType functions and with the SetAttr statement.


See Also

IMEStatus Function

MsgBox Function

StrConv Function

Visual Basic for Applications Constants


Conversion Procedures (Object Browser)

The Conversion module displays the procedures used to perform conversion operations.

To get Help on a particular procedure

1.	Select the procedure from the Methods/Properties list box.

2.	Choose the [image] button.

Note   When you use Variant variables, explicit data-type conversions are unnecessary.


DateTime Procedures (Object Browser)

The DateTime module displays the procedures used to perform date and time operations.

To get Help on a particular procedure

1.	Select the procedure from the Methods/Properties list box.

2.	Choose the [image] button.


FileSystem Procedures (Object Browser)

The FileSystem module displays the procedures used to perform file or directory and system operations.

To get Help on a particular procedure

1.	Select the procedure from the Methods/Properties list box.

2.	Choose the [image] button.


Financial Procedures (Object Browser)

The Financial module displays procedures used to perform financial operations.

To get Help on a particular procedure

1.	Select the procedure from the Methods/Properties list box.

2.	Choose the [image] button.


Information Procedures (Object Browser)

The Information module displays the procedures used to return, test for, or verify information.

To get Help on a particular procedure

1.	Select the procedure from the Methods/Properties list box.

2.	Choose the [image] button.


Interaction Procedures (Object Browser)

The Interaction module displays procedures used to interact with objects, applications, and systems.

To get Help on a particular procedure

1.	Select the procedure from the Methods/Properties list box.

2.	Choose the [image] button.


Math Procedures (Object Browser)

The Math module displays procedures used to perform mathematical operations.

To get Help on a particular procedure

1.	Select the procedure from the Methods/Properties list box.

2.	Choose the [image] button.


String Procedures (Object Browser)

The String module displays procedures used to perform string operations.

To get Help on a particular procedure

1.	Select the procedure from the Methods/Properties list box.

2.	Choose the [image] button.


AppActivate Statement

See Also

Activates an application window.

Syntax

AppActivate title[, wait]

The AppActivate statement syntax has these named arguments:

Part	Description

title	The title argument is the string expression in the title bar of the application window you want to activate.

In addition, the task ID returned by the Shell function can be used, in place of title, to activate an application.

wait	Boolean value specifying whether the calling application has the focus before activating another.  If False (default), the specified application is immediately activated, even if the calling application does not have the focus.  If True, the calling application waits until it has the focus, then activates the specified application.

Remarks

The AppActivate statement changes the focus to the named application or window but does not affect whether it is maximized or minimized.  Focus moves from the activated application window when the user takes some action to change the focus or close the window.  Use the Shell function to start an application and set the window style.

In determining which application to activate, title is compared to the title string of each running application.  If there is no exact match, any application whose title string begins with title is activated.  If there is more than one instance of the application named by title, one is arbitrarily activated.


 See Also

Shell Function

SendKeys Statement


Beep Statement

Sounds a tone through the computer's speaker.

Syntax

Beep

Remarks

The frequency and duration of the beep depend on your hardware and system software and vary among computers.


InputBox Function

See Also

Displays a prompt in a dialog box, waits for the user to input text or choose a button, and returns the contents of the text box.

Syntax

InputBox(prompt[, title][, default][, xpos][, ypos][, helpfile, context])

The InputBox function syntax has these named 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 either 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	String expression that identifies the Help file to use to provide context-sensitive Help for the dialog box. If helpfile is provided, context must also be provided.

context	Numeric expression that is the Help context number the Help author assigned to the appropriate Help topic.  If context is provided, helpfile must also be provided.

Remarks

When both helpfile and context are supplied, a Help button is automatically added to the dialog box.

If the user chooses OK or presses ENTER, the InputBox function returns whatever is in the text box.  If the user chooses Cancel, the function returns a zero-length string ("").

Note   If you want to specify more than the first named argument, you must use InputBox in an expression.  If you want to omit some positional arguments, you must include the corresponding comma delimiter.


 See Also

MsgBox Function


MsgBox Function

See Also

Displays a message in a dialog box, waits for the user to choose a button, and returns a value indicating which button the user has chosen.

Syntax

MsgBox(prompt[, buttons][, title][, helpfile, context])

The MsgBox function syntax has these named 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 either 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.  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	String expression that identifies the Help file to use to provide context-sensitive Help for the dialog box.  If helpfile is provided, context must also be provided.

context	Numeric expression that is the Help context number the Help author assigned to the appropriate Help topic.  If context is provided, helpfile must also be provided.

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.

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 [image] 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) 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.

Note   These constants are specified by Visual Basic for applications.  As a result, the names can be used anywhere in your code in place of the actual values.

Return Values

Constant	Value	Button chosen

vbOK	1	OK

vbCancel	2	Cancel

vbAbort	3	Abort

vbRetry	4	Retry

vbIgnore	5	Ignore

vbYes	6	Yes

vbNo	7	No

Remarks

When both helpfile and context are provided, the user can press F1 to view the Help topic corresponding to the context.

If the dialog box displays a Cancel button, pressing the ESC key has the same effect as choosing Cancel.  If the dialog box contains a Help button, context-sensitive Help is provided for the dialog box.  However, no value is returned until one of the other buttons is chosen.

Note   If you want to specify more than the first named argument, you must use MsgBox in an expression.  If you want to omit some positional arguments, you must include the corresponding comma delimiter.


 See Also

InputBox Function


RGB Function

Returns a whole number representing an RGB color value.

Syntax

RGB (red, green, blue)

The RGB function syntax has these named arguments:

Part	Description

red	Number in the range 0 to 255, inclusive, that represents the red component of the color.

green	Number in the range 0 to 255, inclusive, that represents the green component of the color.

blue	Number in the range 0 to 255, inclusive, that represents the blue component of the color.

Remarks

Application methods and properties that accept a color specification expect that specification to be a number representing an RGB color value.  An RGB color value specifies the relative intensity of red, green, and blue to cause a specific color to be displayed.

The value for any argument to RGB that exceeds 255 is assumed to be 255.

The following table lists some standard colors and the red, green, and blue values they include:

Color	Red Value	Green Value	Blue Value

Black	0	0	0

Blue	0	0	255

Green	0	255	0

Cyan	0	255	255

Red	255	0	0

Magenta	255	0	255

Yellow	255	255	0

White	255	255	255


SendKeys Statement

See Also

Sends one or more keystrokes to the active window as if typed at the keyboard.

Syntax

SendKeys string[, wait]

The SendKeys statement syntax has these named arguments :

Part	Description

string	String expression specifying the keystroke(s) to send.

wait	Boolean value specifying the wait mode.  If False (default), control is returned to the procedure immediately after the keys are sent.  If True, keystrokes must be processed before control is returned to the procedure.

Remarks

Each key is represented by one or more characters.  To specify a single keyboard character, use the character itself.  For example, to represent the letter A, use "A" for string.  If you want to represent more than one character, append each additional character to the one preceding it.  To represent the letters A, B, and C, use "ABC" for string.

The plus sign (+), caret (^), percent sign (%), tilde (~), and parentheses ( ) have special meanings to SendKeys.  To specify one of these characters, enclose it within braces.  For example, to specify the plus sign, use {+}.  Brackets ([ ]) have no special meaning to SendKeys, but you must enclose them in braces as well, because in other applications, brackets do have a special meaning that may be significant when dynamic data exchange (DDE) occurs.  To send brace characters, use {{} and {}}.

To specify characters that aren't displayed when you press a key (such as ENTER or TAB) and keys that represent actions rather than characters, use the codes shown below:

Key	Code

BACKSPACE	{BACKSPACE}, {BS}, or {BKSP}

BREAK	{BREAK}

CAPS LOCK	{CAPSLOCK}

DEL	{DELETE} or {DEL}

DOWN ARROW	{DOWN}

END	{END}

ENTER	{ENTER} or ~

ESC	{ESC}

HELP	{HELP}

HOME	{HOME}

INS	{INSERT}

LEFT ARROW	{LEFT}

NUM LOCK	{NUMLOCK}

PAGE DOWN	{PGDN}

PAGE UP	{PGUP}

PRINT SCREEN	{PRTSC}

RIGHT ARROW	{RIGHT}

SCROLL LOCK	{SCROLLLOCK}

TAB	{TAB}

UP ARROW	{UP}

F1	{F1}

F2	{F2}

F3	{F3}

F4	{F4}

F5	{F5}

F6	{F6}

F7	{F7}

F8	{F8}

F9	{F9}

F10	{F10}

F11	{F11}

F12	{F12}

F13	{F13}

F14	{F14}

F15	{F15}

F16	{F16}

To specify keys combined with any combination of the SHIFT, CTRL, and ALT keys, precede the regular key code with one or more of the following codes:

Key	Code

SHIFT	+

CTRL (CONTROL)	^

ALT	%

To specify that any combination of SHIFT, CTRL, and ALT should be held down while several other keys are pressed, enclose the code for those keys in parentheses.  For example, to specify to hold down SHIFT while E and C are pressed, use "+(EC)".  To specify to hold down SHIFT while E is pressed, followed by C without SHIFT, use "+EC".

To specify repeating keys, use the form {key number}.  You must put a space between key and number.  For example, {LEFT 42} means press the LEFT ARROW key 42 times; {h 10} means press h 10 times.

Note   SendKeys can't send keystrokes to an application that is not designed to run in Microsoft Windows.  Sendkeys also can't send the PRINT SCREEN (PRTSC) key to any application.


See Also

AppActivate Statement

DoEvents Function


Circle Method

See Also	Applies To

Draws a circle, ellipse, or arc on an object.  Doesn't support named arguments.

Syntax

object.Circle Step (x, y), radius, color, start, end, aspect

The Circle method syntax has the following parts.

Part	Description

object	Optional.  An object expression that evaluates to an object in the Applies To list.  If object is omitted, the Form with the focus is assumed to be object.

Step	Optional.  A keyword specifying that the center of the circle, ellipse, or arc is relative to the current coordinates given by the CurrentX and CurrentY properties of object.

(x, y)	Required.  Single-precision 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-precision 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 or QBColor function to specify the color.

start, end	Optional.  Single-precision values.  When an arc or a partial circle or ellipse is drawn, start and end specify (in radians) the beginning and end positions of the arc.  The range for both is -2 pi radians to 2 pi radians.  The default value for start is 0 radians; the default for end is 2 * pi radians.

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).

When drawing a partial circle or ellipse, if start is negative, Circle draws a radius to start, and treats the angle as positive; if end is negative, Circle draws a radius to end and treats the angle as positive.  The Circle method always draws in a counter-clockwise (positive) direction.

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.

When drawing pie slices, to draw a radius to angle 0 (giving a horizontal line segment to the right), specify a very small negative value for start, rather than zero.

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 trailing argument, don't use any commas following the last argument you specify.

When Circle executes, the CurrentX and CurrentY properties are set to the center point specified by the arguments.


See Also

BackColor, ForeColor Properties

CurrentX, CurrentY Properties

DrawMode Property

DrawStyle Property

DrawWidth Property

FillColor Property

FillStyle Property

Line Method

RGB Function

ScaleMode Property

Shape Control


Circle Method Applies To

Form Object

PictureBox Control


Command Function

Returns the argument portion of the command line used to launch Microsoft Visual Basic or an executable program developed with Visual Basic.

Syntax

Command

Note   For Visual Basic in-process OLE server (DLL) considerations and restrictions that apply to this topic, see Make OLE DLL File Command.

Remarks

When Visual Basic is launched from the command line, any portion of the command line that follows /CMD is passed to the program as the command-line argument.  In the following example, cmdlineargs represents the argument information returned by the Command function.

VB /CMD cmdlineargs

For applications developed with Visual Basic and compiled to an .EXE file, Command returns any argument(s) that appears after the name of the application on the command line.  For example:

MyApp cmdlineargs

In the Code window, you can change the text returned by Command by choosing Project Options from the Tools menu.


Line Method

See Also	Applies To

Draws lines and rectangles on an object.  Doesn't support named arguments.

Syntax

object.Line Step (x1, y1) - Step (x2, y2), color, BF

The Line method syntax has the following parts:

Part	Description

object	Optional.  An object expression that evaluates to an object in the Applies To list.  If object is omitted, the Form with the focus is assumed to be object.

Step	Optional.  A keyword specifying that the starting point coordinates are relative to the current graphics position given by the CurrentX and CurrentY properties.

(x1, y1)	Optional.  Single-precision 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.

Step	Optional.  A keyword specifying that the end point coordinates are relative to the line starting point.

(x2, y2)	Required.  Single-precision 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 QBColor function to specify the color.

B	Optional.  If included, causes a box to be drawn using the coordinates to specify opposite corners of the box.

F	Optional.  If the B option is used, the F option specifies that the box is filled with the same color used to draw the box.  You cannot use F without B.  If B is used without F, 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.


See Also

Circle Method

CurrentX, CurrentY Properties

DrawMode Property

DrawStyle Property

DrawWidth Property

FillColor Property

FillStyle Property

ForeColor Property

RGB Function

ScaleMode Property

Shape Control


Line Method Applies To

Form Object

PictureBox Control


PSet Method

See Also	Applies To

Sets a point on an object to a specified color. Doesn't support named arguments.

Syntax

object.PSet Step (x, y), color

The PSet method syntax has the following parts:

Part	Description

object	Optional.  An object expression that evaluates to an object in the Applies To list.  If object is omitted, the Form with the focus is assumed to be object.

Step	Optional.  A keyword specifying that the coordinates are relative to the current graphics position given by the CurrentX and CurrentY properties.

(x, y)	Required.  Single-precision 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 or QBColor function to specify the color.

Remarks

The size of the point drawn depends on the setting of the DrawWidth property.  When DrawWidth is 1, PSet sets a single pixel to the specified color.  When DrawWidth is greater than 1, the point is centered on the specified coordinates.

The way the point is drawn depends on the setting of the DrawMode and DrawStyle properties.

When PSet executes, the CurrentX and CurrentY properties are set to the point specified by the arguments.

Clear a single pixel with the PSet method by specifying the coordinates of the pixel and using the BackColor property setting as the color argument.


See Also

BackColor, ForeColor Properties

CurrentX, CurrentY Properties

DrawMode Property

DrawStyle Property

DrawWidth Property

RGB Function


PSet Method Applies To

Form Object

PictureBox Control


Operator Summary

See Also

Arithmetic Operators

Operators used to perform mathematical calculations.

Comparison Operators

Operators used to perform comparisons.

Concatenation Operators

Operators used to combine strings.

Logical Operators

Operators used to perform logical operations.


See Also

Operator Precedence


Operator Precedence

See Also

When several operations occur in an expression, each part is evaluated and resolved in a predetermined order.  That order is known as operator precedence.  Parentheses can be used to override the order of precedence and force some parts of an expression to be evaluated before others.  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	Comparison	Logical

Exponentiation (^)	Equality (=)	Not

Negation (-)'	Inequality (<>)	And

Multiplication and division (*,/)	Less than (<)	Or

Integer division (\)	Greater than (>)	Xor

Modulo arithmetic (Mod)	Less than or Equal to (<=)	Eqv

Addition and subtraction (+,-)	Greater than or Equal to (>=)	Imp

String concatenation (&)	Like

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.  Similarly, the Like operator, while equal in precedence to all comparison operators, is actually a pattern-matching operator.  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.


 See Also

Is Operator

Like Operator

Operator Summary


Arithmetic Operators

^ Operator

* Operator

/ Operator

\ Operator

Mod Operator

+ Operator

- Operator


Concatenation Operators

& Operator

+ Operator


Logical Operators

And Operator

Eqv Operator

Imp Operator

Not Operator

Or Operator

Xor Operator


^ Operator

See Also

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.

Usually, the data type of result is a Double or a Variant containing a Double.  However, if either number or exponent is a Null expression, result is also Null.


 See Also

Arithmetic Operators

Operator Precedence

Operator Summary


+ Operator

See Also

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.  If at least one expression is not a Variant, the following rules apply:

If	Then
Both expressions are numeric data types (Byte, Boolean, Integer, Long, Single, Double, Date, or Currency)	Add.
Both expressions are String	Concatenate.
One expression is a numeric data type and the other is any Variant (except Null)	Add.
One expression is a String and the other is any Variant (except Null)	Concatenate.
One expression is an Empty Variant	Return the remaining expression unchanged as result.
One expression is a numeric data type and the other is a String	A Type mismatch error occurs.
Either expression is Null	result is Null.
If both expressions are Variant expressions, the underlying type of the expressions determines the behavior of the + operator in the following way:

If	Then
Both Variant expressions are numeric	Add.
Both Variant expressions are strings	Concatenate.
One Variant expression is numeric and the other is a string	Add.
For simple arithmetic addition involving only expressions of numeric data types, the data type of result is usually the same as that of the most precise expression.  The order of precision, from least to most precise, is Byte, Integer, Long, Single, Double, and Currency.  The following are exceptions to this order:

When a Single and a Long are added together, the data type of result is converted to a Double.

When the data type of result is a Long, Single, or Date variant that overflows its legal range, result is converted to a Double variant.

When the data type of result is a Byte variant that overflows its legal range, result is converted to an Integer variant.

When the data type of result is an Integer variant that overflows its legal range, result is converted to a Long variant.

When a Date is added to any data type, the data type of result is always a Date.

Note   The order of precision used by addition and subtraction is not the same as the order of precision used by multiplication.

If one or both expressions are Null expressions, result is Null.  If both expressions are Empty, result is an Integer.  However, if only one expression is Empty, the other expression is returned unchanged as result.


 See Also

Arithmetic Operators

Concatenation Operators

Operator Precedence

Operator Summary


- Operator

See Also

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.

The data type of result is usually the same as that of the most precise expression.  The order of precision, from least to most precise, is Byte, Integer, Long, Single, Double, Currency.  The following are exceptions to this order:

When subtraction involves a Single and a Long, the data type of result is converted to a Double.

When the data type of result is a Long, Single, or Date variant that overflows its legal range, result is converted to a Variant containing a Double.

When the data type of result is a Byte variant that overflows its legal range, result is converted to an Integer variant.

When the data type of result is an Integer variant that overflows its legal range, result is converted to a Long variant.

When subtraction involves a Date and any other data type, the data type of result is a Date.

When subtraction involves two Date expressions, the data type of result is Double.

Note   The order of precision used by addition and subtraction is not the same as the order of precision used by multiplication.

If one or both expressions are Null expressions, result is Null.  If an expression is Empty, it is treated as if it were 0.


 See Also

Arithmetic Operators

Operator Precedence

Operator Summary


* Operator

See Also

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

The data type of result is usually the same as that of the most precise expression.  The order of precision, from least to most precise, is Byte, Integer, Long, Single, Currency, Double.  The following are exceptions to this order:

When multiplication involves a Single and a Long, the data type of result is converted to a Double.

When the data type of result is a Long, Single, or Date variant that overflows its legal range, result is converted to a Variant containing a Double.

When the data type of result is a Byte variant that overflows its legal range, result is converted to an Integer variant.

When the data type of result is an Integer variant that overflows its legal range, result is converted to a Long variant.

Note   The order of precision used by multiplication is not the same as the order of precision used by addition and subtraction.

If one or both expressions are Null expressions, result is Null.  If an expression is Empty, it is treated as if it were 0.


 See Also

Arithmetic Operators

Operator Precedence

Operator Summary


/ Operator

See Also

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 variable.

number1	Any numeric expression.

number2	Any numeric expression.

Remarks

The data type of result is usually a Double or a Double variant.  The following are exceptions to this rule:

When both expressions are Byte, Integer, or Single expressions, result is a Single unless it overflows its legal range; in which case, an error occurs.

When both expressions are Byte, Integer, or Single variants, result is a Single variant unless it overflows its legal range; in which case, result is a Variant containing a Double.

If one or both expressions are Null expressions, result is Null.  Any expression that is Empty is treated as 0.


 See Also

Arithmetic Operators

Operator Precedence

Operator Summary


\ Operator

See Also

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, the numeric expressions are rounded to Byte, Integer, or Long expressions.

Usually, the data type of result is a Byte, Byte variant, Integer, Integer variant, Long, or Long variant, regardless of whether result is a whole number.  Any fractional portion is truncated.  However, if any expression is Null, result is also Null.  Any expression that is Empty is treated as 0.


 See Also

Arithmetic Operators

Operator Precedence

Operator Summary


Mod Operator

See Also

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

Usually, the data type of result is a Byte, Byte variant, Integer, Integer variant, Long, or Variant containing a Long, regardless of whether or not result is a whole number.  Any fractional portion is truncated.  However, if any expression is Null, result is also Null.  Any expression that is Empty is treated as 0.


 See Also

Arithmetic Operators

Operator Precedence

Operator Summary


& Operator

See Also

Used to force string concatenation of two expressions.

Syntax

result = expression1 & expression2

The & operator syntax has these parts:

Part	Description

result	Any String or Variant variable.

expression1	Any expression.

expression2	Any expression.

Remarks

Whenever an expression is not a string, it is converted to a String variant.  The data type of result is String if both expressions are String expressions; otherwise, result is a String variant.  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.


 See Also

Concatenation Operators

Operator Precedence

Operator Summary


Comparison Operators

See Also

Used to compare expressions.

Syntax

result = expression1 comparisonoperator expression2

result = object1 Is object2

result = string Like pattern

Comparison operators have these parts:

Part	Description

result	Any numeric variable.

expression	Any expression.

comparisonoperator	Any comparison operator.

object	Any object name.

string	Any string expression.

pattern	Any string expression or range of characters.

Remarks

The Is and Like operators have specific comparison functionality that differs from the operators in the following table.  The following table contains a list of the comparison operators and the conditions that determine whether result is True, False, or Null:

Operator	Description	True if	False if	Null if
<	Less than	expression1 < expression2	expression1 >= expression2	expression1 or expression2 = Null
<=	Less than or equal to	expression1 <= expression2	expression1 > expression2	expression1 or expression2 = Null
>	Greater than	expression1 > expression2	expression1 <= expression2	expression1 or expression2 = Null
>=	Greater than or equal to	expression1 >= expression2	expression1 < expression2	expression1 or expression2 = Null
=	Equal to	expression1 = expression2	expression1 <> expression2	expression1 or expression2 = Null
<>	Not equal to	expression1 <> expression2	expression1 = expression2	expression1 or expression2 = Null
When comparing two expressions, you may not be able to easily determine whether the expressions are being compared as numbers or as strings.  The following table shows how the expressions are compared or what results when either expression is not a Variant:

If	Then
Both expressions are numeric data types (Byte, Boolean, Integer, Long, Single, Double, Date, or Currency)	Perform a numeric comparison.
Both expressions are String	Perform a string comparison.
One expression is a numeric data type and the other is a Variant that is, or can be, a number	Perform a numeric comparison.
One expression is a numeric data type and the other is a string Variant that can't be converted to a number	A Type Mismatch error occurs.
One expression is a String and the other is any Variant (except a Null)	Perform a string comparison.
One expression is Empty and the other is a numeric data type	Perform a numeric comparison, using 0 as the Empty expression.
One expression is Empty and the other is a String	Perform a string comparison, using a zero-length string as the Empty expression.
If expression1 and expression2 are both Variant expressions, their underlying type determines how they are compared.  The following table shows how the expressions are compared or what results from the comparison, depending on the underlying type of the Variant:

If	Then
Both Variant expressions are numeric	Perform a numeric comparison.
Both Variant expressions are strings	Perform a string comparison.
One Variant expression is numeric and the other is a string	The numeric expression is less than the string expression.
One Variant expression is Empty and the other is numeric	Perform a numeric comparison, using 0 as the Empty expression.
One Variant expression is Empty and the other is a string	Perform a string comparison, using a zero-length string as the Empty expression.
Both Variant expressions are Empty	The expressions are equal.
Note   If a Currency is compared with a Single or Double, the Single or Double is converted to a Currency.  This causes any fractional part of the Single or Double value less than 0.0001 to be lost and may cause two values to compare as equal when they are not.  When a Single is compared to a Double, the Double is rounded to the precision of the Single.


 See Also

Is Operator

Like Operator

Operator Precedence

Operator Summary


And Operator

See Also

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 variable.

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 bit-wise comparison of identically positioned bits in two numeric expressions and sets the corresponding bit in result according to the following truth table:

If bit in expression1 is	And bit in expression2 is	The result is

0	0	0

0	1	0

1	0	0

1	1	1


 See Also

Logical Operators

Operator Precedence

Operator Summary


Eqv Operator

See Also

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 variable.

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 bit-wise comparison of identically positioned bits in two numeric expressions and sets the corresponding bit in result according to the following truth table:

If bit in expression1 is	And bit in expression2 is	The result is

0	0	1

0	1	0

1	0	0

1	1	1


 See Also

Logical Operators

Operator Precedence

Operator Summary


Imp Operator

See Also

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 variable.

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 bit-wise comparison of identically positioned bits in two numeric expressions and sets the corresponding bit in result according to the following truth table:

If bit in expression1 is	And bit in expression2 is	The result is

0	0	1

0	1	1

1	0	0

1	1	1


 See Also

Logical Operators

Operator Precedence

Operator Summary


Not Operator

See Also

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	Then 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 truth table:

Bit in expression	Bit in result

0	1

1	0


 See Also

Logical Operators

Operator Precedence

Operator Summary


Or Operator

See Also

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 bit-wise comparison of identically positioned bits in two numeric expressions and sets the corresponding bit in result according to the following truth table:

If bit in expression1 is	And bit in expression2 is	The result is

0	0	0

0	1	1

1	0	1

1	1	1


 See Also

Logical Operators

Operator Precedence

Operator Summary


Xor Operator

See Also

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 bit-wise comparison of identically positioned bits in two numeric expressions and sets the corresponding bit in result according to the following truth table:

If bit in expression1 is	And bit in expression2 is	The result is

0	0	0

0	1	1

1	0	1

1	1	0


 See Also

Logical Operators

Operator Precedence

Operator Summary


Like Operator

See Also

Used to compare two strings.

Syntax

result = string Like pattern

The Like operator syntax has these parts:

Part	Description

result	Any numeric variable.

string	Any string expression.

pattern	Any string expression conforming to the pattern-matching conventions described in Remarks.

Remarks

If string matches pattern, result is True; if there is no match, result is False; and if either string or pattern is Null, result is also Null.

The behavior of the Like operator depends on the Option Compare statement.  Unless otherwise specified, the default string-comparison method for each module is Option Compare Binary.

Option Compare Binary results in string comparisons based on a sort order derived from the internal binary representations of the characters.  Sort order is determined by the code page.  In the following example, a typical binary sort order is shown:

A < B < E < Z < a < b < e < z < À < Ê < Ø < à < ê < ø

Option Compare Text results in string comparisons based on a case-insensitive textual sort order determined by your system's locale. The same characters shown above, when sorted using Option Compare Text, produce the following text sort order:

(A=a) < (À=à) < (B=b) < (E=e) < (Ê=ê) < (Z=z) < (Ø=ø)

Built-in pattern matching provides a versatile tool for string comparisons.  The pattern-matching features allow you to use wildcard characters, character lists, or character ranges, in any combination, to match strings.  The following table shows the characters allowed in pattern and what they match:

Character(s) in pattern	Matches in string

?	Any single character.

*	Zero or more characters.

#	Any single digit (0 [image] 9).

[charlist]	Any single character in charlist.

[!charlist]	Any single character not in charlist.

A group of one or more characters (charlist) enclosed in brackets ([ ]) can be used to match any single character in string and can include almost any character code, including digits.

Note   The special characters left bracket ([), question mark (?), number sign (#), and asterisk (*) can be used to match themselves directly only by enclosing them in brackets.  The right bracket (]) can't be used within a group to match itself, but it can be used outside a group as an individual character.

In addition to a simple list of characters enclosed in brackets, charlist can specify a range of characters by using a hyphen (-) to separate the upper and lower bounds of the range.  For example, [A-Z] in pattern results in a match if the corresponding character position in string contains any of the uppercase letters in the range A through Z.  Multiple ranges are included within the brackets without any delimiters.

The meaning of a specified range depends on the character ordering valid at run time (as determined by Option Compare and the locale setting of the system the code is running on).  Using the same example shown above with Option Compare Binary, the range [A [image] E] matches A, B and E.  With Option Compare Text, [A [image] E] matches A, a, À, à, B, b, E, e.  Note that it does not match Ê or ê because accented characters fall after unaccented characters in the sort order.

Other important rules for pattern matching include the following:

An exclamation point (!) at the beginning of charlist means that a match is made if any character except the ones in charlist is found in string.  When used outside brackets, the exclamation point matches itself.

The hyphen (-) can appear either at the beginning (after an exclamation point if one is used) or at the end of charlist to match itself.  In any other location, the hyphen is used to identify a range of characters.

When a range of characters is specified, they must appear in ascending sort order (from lowest to highest).  [A-Z] is a valid pattern, but [Z-A] is not.

The character sequence [] is ignored; it is considered a zero-length string.

In some languages, there are special characters in the alphabet that actually represent two separate characters.  For example, several languages use the character "æ" to represent the characters "a" and "e" when they appear together.  The Like operator recognizes that the single special character and the two individual characters are equivalent.

When a language that uses one of these special characters is specified in the system locale settings, an occurrence of the single special character in either pattern or string matches the equivalent 2-character sequence in the other string.  Similarly, a single special character in pattern enclosed in brackets (by itself, in a list, or in a range) matches the equivalent 2-character sequence in string.


 See Also

Comparison Operators

Instr Function

Operator Precedence

Operator Summary

StrComp Function


Is Operator

See Also

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


 See Also

Comparison Operators

Operator Precedence

Operator Summary


Chr Function

See Also

Returns the character associated with the specified 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   Another function (ChrB) is provided for use 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.


See Also

Asc Function

Character Set

Str Function


Format Function

See Also

Formats an expression according to instructions contained in a format expression.

Syntax

Format(expression[, format[, firstdayofweek[, firstweekofyear]]])

The Format function syntax has these parts:

Part	Description

expression	Any valid expression.

format	A valid named or user-defined format expression.

firstdayofweek	A constant that specifies the first day of the week, as described in Settings.

firstweekofyear	A constant that specifies the first week of the year, as described in Settings.

Settings

The firstdayofweek argument has these settings:

Constant	Value	Description

vbUseSystem	0	Use 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 has these settings:

Constant	Value	Description

vbUseSystem	0	Use NLS API setting.

vbFirstJan1	1	Start with week in which January 1 occurs (default).

vbFirstFourDays	2	Start with the first week that has at least four days in the year.

vbFirstFullWeek	3	Start with the first full week of the year.

Remarks

To Format	Do This

Numbers	Use predefined named numeric formats or create user-defined numeric formats.

Dates and times	Use predefined named date/time formats or create user-defined date/time formats.

Date and time serial numbers	Use date and time formats or numeric formats.

Strings	Create your own user-defined string formats.

If you try to format a number without specifying format, Format provides the same functionality as the Str function.  However, positive numbers formatted as strings using Format lack the leading space reserved for displaying the sign of the value; whereas, those converted using Str retain the leading space.


See Also

Different Formats for Different Numeric Values

Different Formats for Different String Values

Named Date/Time Formats

Named Numeric Formats

Str Function

User-Defined Date/Time Formats

User-Defined Numeric Formats

User-Defined String Formats


Named Numeric Formats (Format Function)

See Also

The following table identifies the predefined numeric format names:

Format name	Description

General Number	Display number as is, with no thousand separators.

Currency	Display number with thousand separator, if appropriate; display two digits to the right of the decimal separator.  Note that output is based on system locale settings.

Fixed	Display at least one digit to the left and two digits to the right of the decimal separator.

Standard	Display number with thousands separator, at least one digit to the left and two digits to the right of the decimal separator.

Percent	Display number multiplied by 100 with a percent sign (%) appended to the right; always display two digits to the right of the decimal separator.

Scientific	Use standard scientific notation.

Yes/No	Display No if number is 0; otherwise, display Yes.

True/False	Display False if number is 0; otherwise, display True.

On/Off	Display Off if number is 0; otherwise, display On.


See Also

Format Function

Named Date/Time Formats


User-Defined Numeric Formats (Format Function)

See Also

The following table identifies characters you can use to create user-defined number formats:

Character	Description

None	No formatting

Display the number with no formatting.

0	Digit placeholder

Display a digit or a zero.  If the expression has a digit in the position where the 0 appears in the format string, display it; otherwise, display a zero in that position.

If the number has fewer digits than there are zeros (on either side of the decimal) in the format expression, display leading or trailing zeros.  If the number has more digits to the right of the decimal separator than there are zeros to the right of the decimal separator in the format expression, round the number to as many decimal places as there are zeros.  If the number has more digits to the left of the decimal separator than there are zeros to the left of the decimal separator in the format expression, display the extra digits without modification.

#	Digit placeholder

Display a digit or nothing.  If the expression has a digit in the position where the # appears in the format string, display it; otherwise, display nothing in that position.

This symbol works like the 0 digit placeholder, except that leading and trailing zeros aren't displayed if the number has the same or fewer digits than there are # characters on either side of the decimal separator in the format expression.

.	Decimal placeholder

In some locales, a comma is used as the decimal separator.  The decimal placeholder determines how many digits are displayed to the left and right of the decimal separator.  If the format expression contains only number signs to the left of this symbol, numbers smaller than 1 begin with a decimal separator.  If you always want a leading zero displayed with fractional numbers, use 0 as the first digit placeholder to the left of the decimal separator instead.  The actual character used as a decimal placeholder in the formatted output depends on the Number Format recognized by your system.

%	Percentage placeholder

The expression is multiplied by 100.  The percent character (%) is inserted in the position where it appears in the format string.

,	Thousand separator

In some locales, a period is used as a thousand separator.  The thousand separator separates thousands from hundreds within a number that has four or more places to the left of the decimal separator.  Standard use of the thousand separator is specified if the format contains a thousand separator surrounded by digit placeholders (0 or #).  Two adjacent thousand separators or a thousand separator immediately to the left of the decimal separator (whether or not a decimal is specified) means "scale the number by dividing it by 1000, rounding as needed."  You can scale large numbers using this technique.  For example, you can use the format string "##0,," to represent 100 million as 100.  Numbers smaller than 1 million are displayed as 0.  Two adjacent thousand separators in any position other than immediately to the left of the decimal separator are treated simply as specifying the use of a thousand separator.  The actual character used as the thousand separator in the formatted output depends on the Number Format recognized by your system.

:	Time separator

In some locales, other characters may be used to represent the time separator.  The time separator separates hours, minutes, and seconds when time values are formatted.  The actual character used as the time separator in formatted output is determined by your system settings.

/	Date separator

In some locales, other characters may be used to represent the date separator.  The date separator separates the day, month, and year when date values are formatted.  The actual character used as the date separator in formatted output is determined by your system settings.

E- E+ e- e+	Scientific format

If the format expression contains at least one digit placeholder (0 or #) to the right of E-, E+, e-, or e+, the number is displayed in scientific format and E or e is inserted between the number and its exponent.  The number of digit placeholders to the right determines the number of digits in the exponent.  Use E- or e- to place a minus sign next to negative exponents.  Use E+ or e+ to place a minus sign next to negative exponents and a plus sign next to positive exponents.

- + $ ( ) space	Display a literal character

To display a character other than one of those listed, precede it with a backslash (\) or enclose it in double quotation marks (" ").

\	Display the next character in the format string

Many characters in the format expression have a special meaning and can't be displayed as literal characters unless they are preceded by a backslash.  The backslash itself isn't displayed.  Using a backslash is the same as enclosing the next character in double quotation marks.  To display a backslash, use two backslashes (\\).

Examples of characters that can't be displayed as literal characters are the date- and time-formatting characters (a, c, d, h, m, n, p, q, s, t, w, y, and /:), the numeric-formatting characters (#, 0, %, E, e, comma, and period), and the string-formatting characters (@, &, <, >, and !).

"ABC"	Display the string inside the double quotation marks

To include a string in format from within code, you must use Chr(34) to enclose the text (34 is the character code for a double quotation mark).


See Also

Different Formats for Different Numeric Values

Format Function

User-Defined Date/Time Formats

User-Defined String Formats


Different Formats for Different Numeric Values (Format Function)

See Also

A user-defined format expression for numbers can have from one to four sections separated by semicolons.  (If the format argument contains one of the named numeric formats, only one section is allowed.)

If you use	The result is

One section only	The format expression applies to all values.

Two sections	The first section applies to positive values and zeros, the second to negative values.

Three sections	The first section applies to positive values, the second to negative values, and the third to zeros.

Four sections	The first section applies to positive values, the second to negative values, the third to zeros, and the fourth to Null values.

The following example has two sections: the first defines the format for positive values and zeros; the second section defines the format for negative values.

"$#,##0;($#,##0)"

If you include semicolons with nothing between them, the missing section is printed using the format of the positive value.  For example, the following format displays positive and negative values using the format in the first section and displays "Zero" if the value is zero.

"$#,##0;;\Z\e\r\o"


See Also

Different Formats for Different String Values

Format Function


User-Defined Numeric Format Examples

Some sample format expressions for numbers are shown below. (These examples all assume that your system's locale setting is English-U.S.)  The first column contains the format strings.  The other columns contain the output that results if the formatted data has the value given in the column headings.

Format (format)	Positive 5	Negative 5	Decimal .5	Null

Zero-length string	5	-5	0.5

0	5	-5	1

0.00	5.00	-5.00	0.50

#,##0	5	-5	1

#,##0.00;;;Nil	5.00	-5.00	0.50	Nil

$#,##0;($#,##0)	$5	($5)	$1

$#,##0.00;($#,##0.00)	$5.00	($5.00)	$0.50

0%	500%	-500%	50%

0.00%	500.00%	-500.00%	50.00%

0.00E+00	5.00E+00	-5.00E+00	5.00E-01

0.00E-00	5.00E00	-5.00E00	5.00E-01


Named Date/Time Formats (Format Function)

See Also

The following table identifies the predefined date and time format names:

Format Name	Description

General Date	Display a date and/or time.  For real numbers, display a date and time (for example, 4/3/93 05:34 PM); if there is no fractional part, display only a date (for example, 4/3/93); if there is no integer part, display time only (for example, 05:34 PM).  Date display is determined by your system settings.

Long Date	Display a date according to your system's long date format.

Medium Date	Display a date using the medium date format appropriate for the language version of Visual Basic.

Short Date	Display a date using your system's short date format.

Long Time	Display a time using your system's long time format: includes hours, minutes, seconds.

Medium Time	Display time in 12-hour format using hours and minutes and the AM/PM designator.

Short Time	Display a time using the 24-hour format (for example, 17:45).


See Also

Format Function

Named Numeric Formats


User-Defined Date/Time Formats (Format Function)

See Also

The following table identifies characters you can use to create user-defined date/time formats:

Character	Description

:	Time separator.  In some locales, other characters may be used to represent the time separator.  The time separator separates hours, minutes, and seconds when time values are formatted.  The actual character used as the time separator in formatted output is determined by your system settings.

/	Date separator.  In some locales, other characters may be used to represent the date separator.  The date separator separates the day, month, and year when date values are formatted.  The actual character used as the date separator in formatted output is determined by your system settings.

c	Display the date as ddddd and display the time as t t t t t, in that order.  Display only date information if there is no fractional part to the date serial number; display only time information if there is no integer portion.

d	Display the day as a number without a leading zero (1 [image] 31).

dd	Display the day as a number with a leading zero (01 [image] 31).

ddd	Display the day as an abbreviation (Sun [image] Sat).

dddd	Display the day as a full name (Sunday [image] Saturday).

ddddd	Display the date as a complete date (including day, month, and year), formatted according to your system's short date format setting.  The default short date format is m/d/yy.

dddddd	Display a date serial number as a complete date (including day, month, and year) formatted according to the long date setting recognized by your system.  The default long date format is mmmm dd, yyyy.

w	Display the day of the week as a number (1 for Sunday through 7 for Saturday).

ww	Display the week of the year as a number (1 [image] 53).

m	Display the month as a number without a leading zero (1 [image] 12).  If m immediately follows h or hh, the minute rather than the month is displayed.

mm	Display the month as a number with a leading zero (01 [image] 12).  If m immediately follows h or hh, the minute rather than the month is displayed.

mmm	Display the month as an abbreviation (Jan [image] Dec).

mmmm	Display the month as a full month name (January [image] December).

q	Display the quarter of the year as a number (1 [image] 4).

y	Display the day of the year as a number (1 [image] 366).

yy	Display the year as a 2-digit number (00 [image] 99).

yyyy	Display the year as a 4-digit number (100 [image] 9999).

h	Display the hour as a number without leading zeros (0 [image] 23).

hh	Display the hour as a number with leading zeros (00 [image] 23).

n	Display the minute as a number without leading zeros (0 [image] 59).

nn	Display the minute as a number with leading zeros (00 [image] 59).

s	Display the second as a number without leading zeros (0 [image] 59).

ss	Display the second as a number with leading zeros (00 [image] 59).

t t t t t	Display a time as a complete time (including hour, minute, and second), formatted using the time separator defined by the time format recognized by your system.  A leading zero is displayed if the leading zero option is selected and the time is before 10:00 A.M. or P.M.  The default time format is h:mm:ss.

AM/PM	Use the 12-hour clock and display an uppercase AM with any hour before noon; display an uppercase PM with any hour between noon and 11:59 P.M.

am/pm	Use the 12-hour clock and display a lowercase AM with any hour before noon; display a lowercase PM with any hour between noon and 11:59 P.M.

A/P	Use the 12-hour clock and display an uppercase A with any hour before noon; display an uppercase P with any hour between noon and 11:59 P.M.

a/p	Use the 12-hour clock and display a lowercase A with any hour before noon; display a lowercase P with any hour between noon and 11:59 P.M.

AMPM	Use the 12-hour clock and display the AM string literal as defined by your system with any hour before noon; display the PM string literal as defined by your system with any hour between noon and 11:59 P.M.  AMPM can be either uppercase or lowercase, but the case of the string displayed matches the string as defined by your system settings.  The default format is AM/PM.


See Also

Format Function

User-Defined Numeric Formats

User-Defined String Formats


User-Defined Date/Time Format Examples

The following are examples of user-defined date and time formats for December 7, 1958:

Format	Display

m/d/yy	12/7/58

d-mmm	7-Dec

d-mmmm-yy	7-December-58

d mmmm	7 December

mmmm yy	December 58

hh:mm AM/PM	08:50 PM

h:mm:ss a/p	8:50:35 p

h:mm	20:50

h:mm:ss	20:50:35

m/d/yy h:mm	12/7/58 20:50


User-Defined String Formats (Format Function)

See Also

You can use any of the following characters to create a format expression for strings:

Character	Description

@	Character placeholder

Display a character or a space.  If the string has a character in the position where the @ appears in the format string, display it; otherwise, display a space in that position.  Placeholders are filled from right to left unless there is an ! character in the format string.  See below.

&	Character placeholder

Display a character or nothing.  If the string has a character in the position where the & appears, display it; otherwise, display nothing.  Placeholders are filled from right to left unless there is an ! character in the format string.  See below.

<	Force lowercase

Display all characters in lowercase format.

>	Force uppercase

Display all characters in uppercase format.

!	Force left to right fill of placeholders

The default is to fill from right to left.


See Also

Different Formats for Different String Values

Format Function

User-Defined Date/Time Formats

User-Defined Numeric Formats


Different Formats for Different String Values (Format Function)

See Also

A format expression for strings can have one section, or two sections separated by a semicolon.

If you use	The result is

One section only	The format applies to all string data.

Two sections	The first section applies to string data, the second to Null values and zero-length strings.


See Also

Different Formats for Different Numeric Values

Format Function


Hex Function

See Also

Returns a string representing the hexadecimal value of a number.

Syntax

Hex(number)

The number argument is any valid numeric or string 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.


See Also

Oct Function


InStr Function

See Also

Returns the position of the first occurrence of one string within another.

Syntax

InStr([start, ]string1, string2[, compare])

The InStr function syntax has these named arguments:

Part	Description

start	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	String expression being searched.

string2	String expression sought.

compare	Specifies the type of string comparison.  The compare argument can be omitted, it can be 0 or 1, or it can be the value of the CollatingOrder property of a Field object.  Specify 0 (default) to perform a binary comparison.  Specify 1 to perform a textual, case-insensitive comparison.  Specify the return value of the CollatingOrder property of a Field object if you want to sort or compare values from a database in the same way the database itself would.  If compare is Null, an error occurs.  The start argument is required if compare is specified.  If compare is omitted, the Option Compare setting determines the type of comparison.

Return 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 > string2	0

Remarks

Note   Another function (InStrB) is provided for use 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.


See Also

STRComp Function


LCase Function

See Also

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.


See Also

UCase Function


Left Function

See Also

Returns a specified number of characters from the left side of a string.

Syntax

Left(string, length)

The Left function syntax has these named 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   Another function (LeftB) is provided for use with byte data contained in a string.  Instead of specifying the number of characters to return, length specifies the number of bytes.


See Also

Len Function

Mid Function

Right Function


Len Function

See Also

Returns the number of characters in a string or the number of bytes required to store a variable.

Syntax

Len(string | varname)

The Len function syntax 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.  If varname is a Variant, Len treats it the same as a String and always returns the number of characters it contains.

Caution   Len may not be able to determine the actual number of storage bytes required when used with user-defined data types.

Note   Another function (LenB) is provided for use 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.


See Also

InStr Function


LSet Statement

See Also

Left aligns a string within a string variable, or copies a variable of one user-defined type to another variable of a different user-defined type.

Syntax

LSet stringvar = string

LSet varname1 = varname2

The LSet statement syntax has these parts:

Part	Description

stringvar	Name of string variable.

string	String expression to be left-aligned within stringvar.

varname1	Variable name of the user-defined type being copied to.

varname2	Variable name of the user-defined type being copied from.

Remarks

LSet replaces any leftover characters in stringvar with spaces.

If string is longer than stringvar, LSet places only the leftmost characters, up to the length of the stringvar, in stringvar.

Warning   Using LSet to copy a variable of one user-defined type into a variable of a different user-defined type is not recommended and should not be done without understanding that copying data of one data type into space reserved for a different data type can cause unpredictable results.

When you copy a variable from one user-defined type to another, the binary data from one variable is simply copied into the memory space of the other, without regard for the data types specified for the elements contained within.


See Also

RSet Statement


LTrim, RTrim, and Trim Functions

See Also

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.


See Also

Left Function

Right Function


Mid Function

See Also

Returns a specified number of characters from a string.

Syntax

Mid(string, start[, length])

The Mid function syntax has these named 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   Another function (MidB) is provided for use with byte data contained in a string.  Instead of specifying the number of characters, the arguments  specify numbers of bytes.


See Also

Left Function

Len Function

LTrim Function

Mid Statement

Right Function

RTrim Function

Trim Function


Mid Statement

See Also

Replaces a specified number of characters in a string variable with characters from another string.

Syntax

Mid(stringvar, start[, length]) = string

The Mid statement syntax has these parts:

Part	Description

stringvar	Name of string variable to modify.

start	Character position in stringvar where the replacement of text begins.

length	Number of characters to replace.  If omitted, all of string is used.

string	String expression that replaces part of stringvar.

Remarks

The number of characters replaced is always less than or equal to the number of characters in stringvar.

Note   Another statement (MidB) is provided for use with byte data contained in a string.  In the MidB statement, start specifies the byte position within stringvar where replacement begins and length specifies the numbers of bytes to replace.


See Also

Mid Function


Oct Function

See Also

Returns a string representing the octal value of a number.

Syntax

Oct(number)

The number argument is any valid numeric or string 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.


See Also

Hex Function


Right Function

See Also

Returns a specified number of characters from the right side of a string.

Syntax

Right(string, length)

The Right function syntax has these named 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   Another function (RightB) is provided for use with byte data contained within a string.  Instead of specifying the number of characters to return, length specifies the number of bytes.


See Also

Left Function

Len Function

Mid Function


RSet Statement

See Also

Right aligns a string within a string variable.

Syntax

RSet stringvar = string

The RSet statement syntax has these parts:

Part	Description

stringvar	Name of string variable.

string	String expression to be right-aligned within stringvar.

Remarks

RSet replaces any leftover characters in stringvar with spaces, back to its beginning.

RSet can't be used with user-defined types.


See Also

LSet Statement


Space Function

See Also

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.

Remarks

The Space function is useful for formatting output and clearing data in fixed-length strings.


See Also

Spc Function

String Function


Str Function

See Also

Returns a string representation of a number.

Syntax

Str(number)

The number argument is any valid numeric expression.

Remarks

When numbers are converted to strings, a leading space is always reserved for the sign of number.  If number is positive, the returned string contains a leading space and the plus sign is implied.

Use the Format function to convert numeric values you want formatted as dates, times, or currency or in other user-defined formats.  Unlike Str, the Format function doesn't include a leading space for the sign of number.

Note   The Str function recognizes only the period (.) as a valid decimal separator.  When a possibility exists that different decimal separators may be used (for example, in international applications), you should use CStr to convert a number to a string.


See Also

CStr Function

Format Function

Val Function


StrComp Function

Returns a value indicating the result of a string comparison.

Syntax

StrComp(string1, string2[, compare])

The StrComp function syntax has these named arguments:

Part	Description

string1	Any valid string expression.

string2	Any valid string expression.

compare	Specifies the type of string comparison.  The compare argument can be omitted, it can be 0 or 1, or it can be the value of the CollatingOrder property of a Field object.  Specify 0 (default) to perform a binary comparison.  Specify 1 to perform a textual comparison.  Specify the return value of the CollatingOrder property if you want to sort or compare values from a database in the same way the database itself would.  If compare is Null, an error occurs.  If compare is omitted, the Option Compare setting determines the type of comparison.

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


String Function

See Also

Returns a repeating character string of the length specified.

Syntax

String(number, character)

The String function syntax has these named 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


See Also

Character Set

Mod Operator

Space Function


UCase Function

See Also

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.


See Also

LCase Function


Windows 95 Control Constants

See Also

The following constants are recognized by the custom controls.  As a result, they can be used anywhere in your code in place of the actual values.

BorderStyle Constants

MousePointer Constants

Use the Object Browser to view the intrinsic constants you can use with methods and properties.  From the View menu, choose Object Browser, select the appropriate control library, and then the Constants object.  You can scroll through the constants that appear under Methods/Properties.

Note   Prefixes for the constants change with the specific control or group of controls.  However, the description remains the same unless indicated.


See Also

Visual Basic Custom Control Constants


MousePointer Constants

See Also

Constant	Value	Description

ccDefault	0	(Default) Shape determined by the object.

ccArrow	1	Arrow.

ccCross	2	Cross (cross-hair pointer).

ccIbeam	3	I Beam.

ccIcon	4	Icon (small square within a square).

ccSize	5	Size (four-pointed arrow pointing north, south, east, and west).

ccSizeNESW	6	Size NE SW (double arrow pointing northeast and southwest).

ccSizeNS	7	Size N S (double arrow pointing north and south).

ccSizeNWSE	8	Size NW, SE.

ccSizeEW	9	Size E W (double arrow pointing east and west).

ccUpArrow	10	Up Arrow.

ccHourglass	11	Hourglass (wait).

ccNoDrop	12	No Drop.

ccArrowHourglass	13	Arrow and hourglass. (Only available in 32-bit Visual Basic.)

cc ArrowQuestion	14	Arrow and question mark. (Only available in 32-bit Visual Basic.)

ccSizeAll	15	Size all. (Only available in 32-bit Visual Basic.)

ccCustom	99	Custom icon specified by the MouseIcon property.

Note   The cc prefix refers to the custom controls.  Prefixes for the constants change with the specific control or group of controls.  However, the description remains the same unless indicated.


See Also

BorderStyle Constants

MouseIcon Property

Visual Basic Custom Control Constants


BorderStyle Constants

See Also

Constant	Value	Description

ccNone	0	(Default)  No border or border-related elements.

ccFixedSingle	1	(Default for ListView control)  Fixed single.  Can include Control-menu box, title bar, Maximize button, and Minimize button.  Resizable only using Maximize and Minimize buttons.

Note   The cc prefix refers to the custom controls.  The prefixes for the constants change with the specific control or group of controls.  However, the description remains the same unless indicated.


See Also

MousePointer Constants

Visual Basic Custom Control Constants


DblClick Event (Custom Controls)

See Also

Occurs when the user presses and releases a mouse button and then presses and releases it again over an object.

For a control, it occurs when the user double-clicks a control with the left mouse button.

Syntax

Private Sub object_DblClick (index As Integer)

Part	Description

object	An object expression that evaluates to a 3D frame, 3D panel, Gauge, Graph, Outline, ListView, RichTextBox, SSTab, StatusBar, TabStrip, Toolbar or TreeView control.

index	Identifies the control if it's in a control array.

Remarks

The argument Index uniquely identifies a control if it's in a control array.  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.

For those objects that receive Mouse events, the events occur in this order: MouseDown, Click, MouseUp, and DblClick.

If DblClick doesn't 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're attaching procedures for these related events, be sure that their actions don't conflict.  Controls that don't receive DblClick events may receive two clicks instead of a DblClick.

Note   To distinguish between the left, right, and middle mouse buttons, use the MouseDown and MouseUp events.


See Also

Click Event

MouseDown, MouseUp Events


Refresh Method (Custom Controls)

Forces a complete repaint of a control.

Syntax

object.Refresh

The object placeholder represents an object expression that evaluates to a 3D check box, 3D command button, 3D frame, 3D group push button, 3D option button, 3D panel, Animated button, Gauge, Graph, Key state, ListView, Masked edit, Multimedia MCI, Outline, RichTextBox, Slider, Spin button, StatusBar, TabStrip, Toolbar or TreeView control.

Remarks

For example, you can use the Refresh method to:

Update the contents of a file-system list box, such as a TreeView control.

Update the data structures of a ListView control.

Generally, painting a control is handled automatically while no events are occurring.  However, there may be situations where you want the 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.


SetFocus Method (Custom Controls)

See Also

Moves the focus to the specified control.

Syntax

object.SetFocus

The object placeholder represents an object expression that evaluates to a 3D check box, 3D command button, 3D option button, Animated button, Gauge, Graph, Key state, ListView, Masked edit, Multimedia MCI, Outline, RichTextBox, Slider, SSTab, TabStrip or TreeView control.

Remarks

The object must be a control that can receive the focus.  After invoking the SetFocus method, any user input is directed to the specified control.

You can only move the focus to a visible control.  Because controls on a form aren't visible until the form's Load event has finished, you can't 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 can't move the focus to a 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.


See Also

Enabled Property


Trappable Errors for Windows 95 Custom Controls

The following table lists the trappable errors for the Windows 95 custom controls.

Error	Message
Number	Explanation

35600	Index out of bounds.

35601	Element not found.

35602	Key is not unique in collection.

35603	Invalid key.

35605	This item's control has been deleted.

35606	Control's collection has been modified.

35607	Required argument is missing.

35609	Property not accessible at design time.

35610	Invalid object.

35611	Property is read-only if image list contains images.

35613	ImageList must be initialized before it can be used.

35614	This would introduce a cycle.

35615	All images in list must be same size.

35616	Maximum Panels Exceeded.

35617	Image cannot be removed while another control is bound to this ImageList.

35618	Overlay parameter must identify one of the first 16 images in the ImageList.


Action Property (CommonDialog)

See Also	Applies To

Returns or sets the type of dialog box to be displayed.  Not available at design time.

Note   The Action property is included for compatibility with earlier versions of Visual Basic.  For additional functionality, use the following new methods: ShowColor, ShowFont, ShowHelp, ShowOpen, ShowPrinter, and ShowSave.

Syntax

object.Action [= value]

The Action property syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

value	A numeric expression specifying the type of dialog box displayed, as described in Settings.

Settings

The settings for value are:

Setting	Description

0	No Action.

1	Displays Open dialog box.

2	Displays Save As dialog box.

3	Displays Color dialog box.

4	Displays Font dialog box.

5	Displays Printer dialog box.

6	Runs WINHELP.EXE.


See Also

ShowColor Method

ShowFont Method

ShowHelp Method

ShowOpen Method

ShowPrinter Method

ShowSave Method


Action Property (CommonDialog) Applies To

CommonDialog Control


BackColor, ForeColor Properties

See Also	Applies To

BackColor [image] returns or sets the background color of an object.

ForeColor [image] returns or sets the foreground color used to display text and graphics in an object.

Syntax

object.BackColor [= color]

object.ForeColor [= color]

The BackColor and ForeColor property syntaxes have these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

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 operating environment red-green-blue (RGB) color scheme.  The settings for color are:

Setting	Description

Normal RGB colors	Colors specified by using the Color palette or by using the RGB or QBColor functions 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 [image] set to the system default color specified by the constant vbWindowBackground.

ForeColor [image] 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 or a PictureBox control, all text and graphics, including the persistent graphics, are erased.  Setting the ForeColor property doesn't 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 isn't 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've selected aren't displayed, one of the selected colors may be dithered [image] 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.


See Also

FillColor Property

FillStyle Property


BackColor, ForeColor Properties Apply To

CheckBox Control

ComboBox Control

CommandButton Control (BackColor only)

DirListBox Control

DriveListBox Control

FileListBox Control

Form Object

Frame Control

Grid Control

Label Control

ListBox Control

MDIForm Object (BackColor only)

OptionButton Control

Shape Control (BackColor only)

TextBox Control


BackStyle Property

See Also	Applies To

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 BackStyle property syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

number	A numeric expression specifying transparency, as described in Settings.

Settings

The settings for number are:

Setting	Description

0	Transparent [image] background color and any graphics are visible behind the control.

1	(Default) Opaque [image] 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're using a background color on a Form object or PictureBox control or when you want to place a control over a graphic.  Use an opaque control when you want it to stand out.

A control's BackColor property is ignored if BackStyle = 0.


See Also

BackColor, ForeColor Properties


BackStyle Property Applies To

Label Control

Shape Control


BorderColor Property

See Also	Applies To

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

Syntax

object.BorderColor [= color]

The BorderColor property syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

color	A value or constant that determines the border color, as described in Settings.

Settings

Visual Basic uses the Microsoft Windows operating environment red-green-blue (RGB) color scheme.  The settings for color are:

Setting	Description

Normal RGB colors	Colors specified using the Color palette or by using the RGB or QBColor functions 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 isn't 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.


See Also

BackColor, ForeColor Properties

DrawWidth Property


BorderColor Property Applies To

Line Control

Shape Control


BorderStyle Property

See Also	Applies To

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 BorderStyleColor property syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

value	A value or constant that determines the border style, as described in Settings.

Settings

The BorderStyle property settings for a Form object are:

Setting	Description

0	None (no border or border-related elements).

1	Fixed Single.  Can include Control-menu box, title bar, Maximize button, and Minimize button.  Resizable only using Maximize and Minimize buttons.

2	(Default) Sizable.  Resizable using any of the optional border elements listed for setting 1.

3	Fixed Dialog.  Can include Control-menu box and title bar; can't include Maximize or Minimize buttons.  Not resizable.

4	Fixed ToolWindow.  Under 16-bit versions of Windows and Windows NT 3.51 and earlier, behaves like Fixed Single.  Does not display Maximize or Minimize buttons.  Not resizable.  Under Windows 95, displays the Close button and displays the title bar text in a reduced font size.  The form does not appear in the Windows 95 task bar.

5	Sizable ToolWindow.  Under 16-bit versions of Windows and Windows NT 3.51 and earlier, behaves like Sizable.  Does not display Maximize or Minimize buttons.  Resizable.  Under Windows 95, displays the Close button and displays the title bar text in a reduced font size.  The form does not appear in the Windows 95 task bar.

The BorderStyle property settings for Grid, Image, Label, OLE container, PictureBox, and TextBox controls are:

Setting	Description

0	(Default for Image and Label controls) None.

1	(Default for Grid, PictureBox, TextBox, and OLE container controls) Fixed Single.

The BorderStyle property settings for Line and Shape controls are:

Setting	Description

0	Transparent.

1	(Default) Solid.  The border is centered on the edge of the shape.

2	Dash.

3	Dot.

4	Dash-dot.

5	Dash-dot-dot.

6	Inside solid.  The outer edge of the border is the outer edge of the shape.

Remarks

For a form, the BorderStyle property determines key characteristics that visually identify a form as either a general-purpose window or a dialog box.  Setting 3 (Fixed Dialog) is useful for standard dialog boxes.  Settings 4 (Fixed ToolWindow) and 5 (Sizable ToolWindow) are useful for creating toolbox-style windows.

MDI child forms set to 2 (Sizable) are displayed within the MDI form in a default size defined by the Windows operating environment at run time.  For any other setting, the form is displayed in the size specified at design time.

Changing the setting of the BorderStyle property of a Form object may change the settings of the MinButton, MaxButton, and ShowInToolbar properties.  When BorderStyle is set to 1 (Fixed Single) or 2 (Sizable), the MinButton, MaxButton, and ShowInToolbar properties are automatically set to True.  When BorderStyle is set to 0 (None), 3 (Fixed Dialog), 4 (Fixed ToolWindow), or 5 (Sizable ToolWindow), the MinButton, MaxButton, and ShowInToolbar properties are automatically set to False.

Note   If a form with a menu is set to 3 (Fixed Dialog), it is displayed with a setting 1 (Fixed Single) border instead.

At run time, a form is either modal or modeless, which you specify using the Show method.


 See Also

Caption Property

ControlBox Property

DrawStyle Property

MaxButton Property

MinButton Property


BorderStyle Property Applies To

Form Object

Grid Control

Image Control

Label Control

Line Control

Shape Control

TextBox Control


BorderWidth Property

See Also	Applies To

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

Syntax

object.BorderWidth [= number]

The BorderWidth property syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

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 Line or Shape control.  The following table shows the effect of BorderStyle settings on the BorderWidth property:

BorderStyle	Effect on BorderWidth

0	BorderWidth setting is ignored.

1 [image] 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.

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


 See Also

BorderStyle Property

DrawWidth Property

Height, Width Properties


BorderWidth Property Applies To

Line Control

Shape Control


Cancel Property

See Also	Applies To

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 or any object within an OLE container control that behaves as a command button.

Syntax

object.Cancel [= boolean]

The Cancel property syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

boolean	A Boolean expression specifying whether the object is the Cancel button, as described in Settings.

Settings

The settings for boolean are:

Setting	Description

True	The CommandButton control is the Cancel button.

False	(Default) The CommandButton control isn't 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's 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.

For OLE container controls, the Cancel property is provided only for those objects that specifically behave as command buttons.

Tip   For a form that supports irreversible operations, such as deletions, it's 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.


 See Also

Default Property

KeyDown, KeyUp Events

KeyPress Event


Cancel Property Applies To

CommandButton Control


CancelError Property

Applies To

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

Syntax

object.CancelError [= boolean]

The CancelError property syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

boolean	A Boolean expression indicating whether an error is generated, as described in Settings.

Settings

The settings for boolean are:

Setting	Description

True	An error is generated.

False	(Default) No error is generated.

Remarks

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


CancelError Property Applies To

CommonDialog Control


Col, Row Properties

See Also	Applies To

Return or set the active cell in a Grid control.  Not available at design time.

Syntax

object.Col [= number]

object.Row [= number]

The Col and Row property syntaxes have these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

number	The number of the column or row containing the active cell.

Remarks

Use these properties to specify a cell in a Grid control or to find out which column or row contains the active cell in a selected region.  Columns and rows are numbered from zero, beginning at the top for rows and at the left for columns.  Setting these properties at run time doesn't change which cells are selected.  Use the SelEndCol, SelStartCol, SelEndRow, and SelStartRow properties to specify a selected region.

Note   The Col and Row properties aren't the same as the Cols and Rows properties.


See Also

Clip Property

Cols, Rows Properties

SelEndCol, SelStartCol, SelEndRow, SelStartRow Properties

Text Property


Col, Row Properties Apply To

Grid Control


Cols, Rows Properties

See Also	Applies To

Return or set the total number of columns or rows in a Grid control.

Syntax

object.Cols [= number]

object.Rows [= number]

The Cols and Rows property syntaxes have these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

number	The number of columns or rows in a Grid control.  The minimum number of columns is 1, the maximum is 400; the minimum number of rows is 1, the maximum is 2000.

Remarks

Use these properties to expand a Grid control dynamically at run time.  A Grid control must have at least one non-fixed column and one non-fixed row.

Note   The Cols and Rows properties aren't the same as the Col and Row properties.


See Also

Col, Row Properties


Cols, Rows Properties Apply To

Grid Control


ControlBox Property

See Also	Applies To

Returns or sets a value indicating whether a Control-menu box is displayed on a form at run time.  Read-only at run time.

Syntax

object.ControlBox

The object placeholder represents an object expression that evaluates to an object in the Applies To list.

Settings

The ControlBox property settings are:

Setting	Description

True	(Default) Displays the Control-menu box.

False	Removes the Control-menu box.

Remarks

To display a Control-menu box, you must also set the form's BorderStyle property to 1 (Fixed Single), 2 (Sizable), or 3 (Fixed Dialog).

Both modal and modeless windows can include a Control-menu box.

The commands available at run time depend on the settings for related properties [image] for example, setting MaxButton and MinButton to False disables the Maximize and Minimize commands on the Control menu, but the Move and Close commands remain available.

Note   Settings you specify for the ControlBox, BorderStyle, MaxButton, and MinButton properties aren't reflected in the form's appearance until run time.


 See Also

BorderStyle Property

MaxButton Property

MinButton Property


ControlBox Property Applies To

Form Object


DefaultExt Property

Applies To

Returns or sets the default filename extension for the dialog box.

Syntax

object.DefaultExt [= string]

The DefaultExt property syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

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.


DefaultExt Property Applies To

CommonDialog Control


DialogTitle Property

Applies To

Returns or sets the string displayed in the title bar of the dialog box.

Syntax

object.DialogTitle [= title]

The DialogTitle property syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

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 or Font dialog boxes.

The default title for an Open dialog box is Open; the default title for a Save As dialog box is Save As.


DialogTitle Property Applies To

CommonDialog Control


DrawWidth Property

See Also	Applies To

Returns or sets the line width for output from graphics methods.

Syntax

object.DrawWidth [= size]

The DrawWidth property syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

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 settings 1 through 4 produce a solid line (the DrawStyle property value isn't changed).  Setting DrawWidth to 1 allows DrawStyle to produce the results shown in the DrawStyle property table.


 See Also

Circle Method

DrawMode Property

DrawStyle Property

FillColor Property

FillStyle Property

ForeColor Property


DrawWidth Property Applies To

Form Object


FileTitle Property

Applies To

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 in the Applies To list.

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.

Note   If the cdlOFNNoValidate flag is set, the FileTitle property won't return a value.


FileTitle Property Applies To

CommonDialog Control


Filter Property (CommonDialog)

See Also	Applies To

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 Filter property syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

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.  Don't 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.


Filter Property (CommonDialog) Applies To

CommonDialog Control


See Also

FilterIndex Property


FilterIndex Property

See Also	Applies To

Returns or sets a default filter for an Open or Save As dialog box.

Syntax

object.FilterIndex [= number]

The FilterIndex property syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

number	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.


FilterIndex Property Applies To

CommonDialog Control


See Also

Filter Property


Flags Property (Color Dialog)

See Also	Applies To

Returns or sets the options for a Color dialog box.

Syntax

object.Flags [= value]

The Flags property syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

value	A constant or value specifying the options for a Color dialog box, as described in Settings.

Settings

The settings for value are:

Constant	Value	Description

cdCClFullOpen	&H2&	Causes the entire dialog box, including the portion that enables the user to create custom colors, to be displayed when the dialog box is created.  Without this flag, the user must choose the Define Custom Colors command button to display this portion of the dialog box.

cdlCCPreventFullOpen	&H4&	Disables the Define Custom Colors command button and prevents the user from defining custom colors.

cdlCCRGBInit	&H1&	Sets the initial color value for the dialog box.

cdlCCShowHelp	&H8&	Causes the dialog box to display a Help button.

Remarks

These constants are listed in the Microsoft CommonDialog Control (MSComDlg) object library in the Object browser.

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:

CMDialog1.Flags = &H10& Or &H200&

Adding the desired constant values produces the same results.  The following is equivalent to the preceding example:

CMDialog1.Flags = &H210&


See Also

Or Operator


Flags Property (Color Dialog) Applies To

CommonDialog Control


Flags Property (File Dialog)

See Also	 	Applies To

Returns or sets the options for the Open and Save As dialog boxes.

Syntax

object.Flags [= value]

The Flags property syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

value	A constant or value specifying the options for the Open and Save As dialog boxes, as described in Settings.

Settings

The settings for value are:

Constant	Value	Description
cdlOFNAllowMultiselect	&H200&	Specifies that the File Name list box allows multiple selections. The user can select more than one file at run time by pressing the SHIFT key and using the UP ARROW and DOWN ARROW keys to select the desired files.  When this is done, the FileName property returns a string containing the names of all selected files.  The names in the string are delimited by spaces.
cdlOFNCreatePrompt	&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.
cdlOFNExtensionDifferent	&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.
cdlOFNFileMustExist	&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.
cdlOFNHideReadOnly	&H4&	Hides the Read Only check box.
cdlOFNNoChangeDir	&H8&	Forces the dialog box to set the current directory to what it was when the dialog box was opened.
cdlOFNNoReadOnlyReturn	&H8000&	Specifies that the returned file won't have the Read Only attribute set and won't be in a write-protected directory.
cdlOFNNoValidate	&H100&	Specifies that the common dialog box allows invalid characters in the returned filename.
cdlOFNOverwritePrompt	&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.
cdlOFNPathMustExist	&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.
cdlOFNReadOnly	&H1&	Causes the Read Only check box to be initially checked when the dialog box is created.  This flag also indicates the state of the Read Only check box when the dialog box is closed.
cdlOFNShareAware	&H4000&	Specifies that sharing violation errors will be ignored.
cdlOFNHelpButton	&H10&	Causes the dialog box to display the Help button.
cdlOFNExplorer	&H8000&	Specifies using the Windows 95 explorer-like Open A File dialog box templete.  (Windows 95 only.)
cdlOFNNoDereferenceLinks	&H100000&	Do not dereference shortcuts (shell links).  By default, choosing a shortcut causes it to be dereferenced by the shell.  (Windows 95 only.)
cdOFNLongNames	&H200000&	Allows the user to use long filenames. Windows 95 only.)
Remarks

These constants are listed in the Microsoft CommonDialog Control (MSComDlg) object library in the Object browser.

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.  For example:

Const ReadOnly  = &H00000001&
Const Effects    = &H00000100&
CMDialog1.Flags = &H10& Or &H200&

Adding the desired constant values produces the same results.  The following is equivalent to the preceding example:

CMDialog1.Flags = &H210&


See Also

DefaultExt Property

FileName Property


Flags Property (File Dialog) Applies To

CommonDialog Control


Flags Property (Font Dialog)

Applies To

Returns or sets the options for the Font dialog box.

Syntax

object.Flags [= value]

The Flags property syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

value	A constant or value specifying the options for a Font dialog box, as described in Settings.

Settings

The settings for value are:

Constant	Value	Description
cdlCFANSIOnly	&H400&	Specifies that the dialog box allows only a selection of the fonts that use the Windows character set.  If this flag is set, the user won't be able to select a font that contains only symbols.
cdlCFBoth	&H3&	Causes the dialog box to list the available printer and screen fonts.  The hDC property identifies the device context associated with the printer.
cdlCFEffects	&H100&	Specifies that the dialog box enables strikethrough, underline, and color effects.
cdlCFFixedPitchOnly	&H4000&	Specifies that the dialog box selects only fixed-pitch fonts.
cdlCFForceFontExist	&H10000&	Specifies that an error message box is displayed if the user attempts to select a font or style that doesn't exist.
cdlCFLimitSize	&H2000&	Specifies that the dialog box selects only font sizes within the range specified by the Min and Max properties.
cdlCFNoSimulations	&H1000&	Specifies that the dialog box doesn't allow graphic device interface (GDI) font simulations.
cdlCFNoVectorFonts	&H800&	Specifies that the dialog box doesn't allow vector-font selections.
cdlCFPrinterFonts	&H2&	Causes the dialog box to list only the fonts supported by the printer, specified by the hDC property.
cdlCFScalableOnly	&H20000&	Specifies that the dialog box allows only the selection of fonts that can be scaled.
cdlCFScreenFonts	&H1&	Causes the dialog box to list only the screen fonts supported by the system.
cdlCFHelpButton	&H4&	Causes the dialog box to display a Help button.
cdlCFTTOnly	&H40000&	Specifies that the dialog box allows only the selection of TrueType fonts.
cdlCFWYSIWYG	&H8000&	Specifies that the dialog box allows only the selection of fonts that are available on both the printer and on screen.  If this flag is set, the cdlCFBoth and cdlCFScalableOnly flags should also be set.
Remarks

These constants are listed in the Microsoft CommonDialog Control (MSComDlg) object library in the Object browser.

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.  For example:

Const ReadOnly  = &H00000001&

Const Effects    = &H00000100&

You can set more than one flag for a dialog box using the Or operator.  For example:

CMDialog1.Flags = &H10& Or &H200&

Adding the desired constant values produces the same results.  The following is equivalent to the preceding example:

CMDialog1.Flags = &H210&

Note   You must set the Flags property to cdlCFScreenFonts, cdlCFPrinterFonts, or cdlCFBoth before displaying the Fonts dialog box.  Otherwise, the error No Fonts Exist occurs.


See Also

hDC Property

Max, Min Properties (CommonDialog)

Or Operator


Flags Property (Font Dialog) Applies To

CommonDialog Control


Flags Property (Print Dialog)

See Also	Applies To

Returns or sets the options for the Print dialog box.

Syntax

object.Flags [= value]

The Flags property syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

value	A constant or value specifying the options for the Print dialog box, as described in Settings.

Settings

The settings for value are:

Constant	Value	Description
cdlPDAllPages	&H0&	Returns or sets the state of the All Pages option button.
cdlPDCollate	&H10&	Returns or sets the state of the Collate check box.
cdlPDDisablePrintToFile	&H80000&	Disables the Print To File check box.
cdlPDHidePrintToFile	&H100000&	Hides the Print To File check box.
cdlPDNoPageNums	&H8&	Disables the Pages option button and the associated edit control.
cdlPDNoSelection	&H4&	Disables the Selection option button.
cdlPDNoWarning	&H80&	Prevents a warning message from being displayed when there is no default printer.
cdlPDPageNums	&H2&	Returns or sets the state of the Pages option button.
cdlPDPrintSetup	&H40&	Causes the system to display the Print Setup dialog box rather than the Print dialog box.
cdlPDPrintToFile	&H20&	Returns or sets the state of the Print To File check box.
cdlPDReturnDC	&H100&	Returns a device context for the printer selection made in the dialog box.  The device context is returned in the dialog box's hDC property.
cdlPDReturnIC	&H200&	Returns an information context for the printer selection made in the dialog box.  An information context provides a fast way to get information about the device without creating a device context.  The information context is returned in the dialog box's hDC property.
cdlPDReturnDefault	&H400&	Returns default printer name.
cdlPDSelection	&H1&	Returns or sets the state of the Selection option button.  If neither cdlPDPageNums nor cdlPDSelection is specified, the All option button is in the selected state.
cdlPDHelpButton	&H800&	Causes the dialog box to display the Help button.
cdlPDUseDevModeCopies	&H40000&	If a printer driver doesn't support multiple copies, setting this flag disables the copies edit control.  If a driver does support multiple copies, setting this flag indicates that the dialog box stores the requested number of copies in the Copies property.
Remarks

These constants are listed in the Microsoft CommonDialog Control (MSComDlg) object library in the Object browser.

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.  For example:

Const ReadOnly  = &H00000001&

Const Effects    = &H00000100&

You can set more than one flag for a dialog box using the Or operator.  For example:

CMDialog1.Flags = &H10& Or &H200&

Adding the desired constant values produces the same results.  The following is equivalent to the preceding example:

CMDialog1.Flags = &H210&


Flags Property (Print Dialog) Applies To

CommonDialog Control


See Also

Copies Property

hDC Property

Or Operator


FontBold, FontItalic, FontStrikethru, FontUnderline Properties

See Also	Applies To

Return or set font styles in the following formats: Bold, Italic, Strikethru, and Underline.

Note   The FontBold, FontItalic, FontStrikethru, and FontUnderline properties are included for use with the CommonDialog control and for compatibility with earlier versions of Visual Basic.  For additional functionality, use the new Font object properties (not available for the CommonDialog control).

Syntax

object.FontBold [= boolean]

object.FontItalic [= boolean]

object.FontStrikethru [= boolean]

object.FontUnderline [= boolean]

The FontBold, FontItalic, FontStrikethru, and FontUnderline property syntaxes have these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

boolean	A Boolean expression specifying the font style as described in Settings.

Settings

The settings for boolean are:

Setting	Description

True	(Default for FontBold, except with the CommonDialog control) Turns on the formatting in that style.

False	(Default for FontItalic, FontStrikethru, and FontUnderline, and FontBold with the CommonDialog control) Turns off the formatting in that style.

Remarks

Use these font properties to format text, either at design time using the Properties window or at run time using code.  For PictureBox controls and Form and Printer objects, setting these properties doesn't 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 operating environment uses a different font for TrueType fonts that are smaller than 8 points.


 See Also

FontName Property

FontSize Property

TextHeight Method

TextWidth Method


FontBold, FontItalic, FontStrikethru, FontUnderline Properties Applies To
FontBold, FontItalic, FontStrikethru, FontUnderline Properties Apply To

CheckBox Control

ComboBox Control

CommandButton Control

CommonDialog Control

DirListBox Control

DriveListBox Control

FileListBox Control

Form Object

Frame Control

Grid Control

Label Control

ListBox Control

OptionButton Control

TextBox Control


FontName Property

See Also	Applies To

Returns or sets the font used to display text in a control or in a run-time drawing or printing operation.

Note   The FontName property is included for use with the CommonDialog control and for compatibility with earlier versions of Visual Basic.  For additional functionality, use the new Font object properties (not available for the CommonDialog control).

Syntax

object.FontName [= font]

The FontName property syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

font	A string expression specifying the font name to use.

Remarks

The default for this property is determined by the system.  Fonts available with Visual Basic 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 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.


See Also

FontBold, FontItalic, FontStrikethru, FontUnderline Properties

FontCount Property

FontSize Property

Print Method

TextHeight Method

TextWidth Method


FontName Property Applies To

CheckBox Control

ComboBox Control

CommandButton Control

CommonDialog Control

DirListBox Control

DriveListBox Control

FileListBox Control

Form Object

Frame Control

Grid Control

Label Control

ListBox Control

OptionButton Control

TextBox Control


FontSize Property

See Also	Applies To

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.

Note   The FontSize property is included for use with the CommonDialog control and for compatibility with earlier versions of Visual Basic.  For additional functionality, use the new Font object properties (not available for the CommonDialog control).

Syntax

object.FontSize [= points]

The FontSize property syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

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 Visual Basic 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.  The Microsoft Windows operating environment uses a different font for TrueType fonts that are smaller than 8 points.


See Also

FontBold, FontItalic, FontStrikethru, FontUnderline Properties

FontCount Property

FontName Property


FontSize Property Applies To

CheckBox Control

ComboBox Control

CommandButton Control

CommonDialog Control

DirListBox Control

DriveListBox Control

FileListBox Control

Form Object

Frame Control

Grid Control

Label Control

ListBox Control

OptionButton Control

TextBox Control


FromPage, ToPage Properties

Applies To

Return or set the values for the From and To text boxes.

Syntax

object.FromPage [= number]

object.ToPage [= number]

The FromPage and ToPage property syntaxes have these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

number	A numeric expression that specifies the first and last pages to be printed.

Remarks

These properties are valid only when the cdlPDPageNums flag has been set.


FromPage, ToPage Properties Apply To

CommonDialog Control (Print Dialog)


Height, Width Properties

See Also	Applies To

Return or set the dimensions of an object or the width of the Columns object of a DBGrid control.  For the Printer and Screen objects, not available at design time.

Syntax

object.Height [= number]

object.Width [= number]

The Height and Width property syntaxes have these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

number	A numeric expression specifying the dimensions of an object, as described in Settings.

Settings

Measurements are calculated as follows:

Form [image] the external height and width of the form, including the borders and title bar.

Control [image] 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.

Printer object [image] the physical dimensions of the paper set up for the printing device; not available at design time.  If set at run time, values in these properties are used instead of the setting of the PaperSize property.

Screen object [image] the height and width of the screen; not available at design time and read-only at run time.

Picture object [image] the height and width of the picture in HiMetric units.

Remarks

For Form, Printer, 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.

If you set the Height and Width properties for a printer driver that doesn't allow these properties to be set, no error occurs and the size of the paper remains as it was.  If you set Height and Width for a printer driver that allows only certain values to be specified, no error occurs and the property is set to whatever the driver allows.  For example, you could set Height to 150 and the driver would set it to 144.

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.

Note   The Height property can't 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 Columns object of the DBGrid control, Width is specified in the unit of measure of the object that contains the DBGrid.  The default value for Width is the value of the DefColWidth property of DBGrid.

For the Picture object, use the ScaleX and ScaleY methods to convert HiMetric units into the scale you need.


See Also

Left, Top Properties

Move Method

PaperSize Property

ScaleHeight, ScaleWidth Properties

ScaleLeft, ScaleTop Properties

ScaleX, ScaleY Methods

Width # Statement


Height, Width Properties Apply To

CheckBox Control

ComboBox Control

CommandButton Control

DirListBox Control

DriveListBox Control

FileListBox Control

Form Object

Frame Control

Grid Control

HScrollBar, VScrollBar Controls

Image Control

Label Control

ListBox Control

MDIForm Object

OptionButton Control

Shape Control

TextBox Control


HelpCommand Property

See Also	Applies To

Returns or sets the type of online Help requested.

Syntax

object.HelpCommand [= value]

The HelpCommand property syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

value	A constant or value specifying the type of Help, as described in Settings.

Settings

The settings for value are:

Constant	Value	Description
cdlHelpCommand	&H102	Executes a Help macro.
cdlHelpContents	&H3	Displays the Help contents topic as defined by the Contents option in the [OPTION] section of the .HPJ file.
cdlHelpContext	&H1	Displays Help for a particular context.  When using this setting, you must also specify a context using the HelpContext property.
cdlHelpContextPopup	&H8	Displays in a pop-up window a particular Help topic identified by a context number defined in the [MAP] section of the .HPJ file.
cdlHelpForceFile	&H9	Ensures that WinHelp displays the correct Help file.  If the correct Help file is currently displayed, no action occurs.  If the incorrect Help file is displayed, WinHelp opens the correct file.
cdlHelpHelpOnHelp	&H4	Displays Help for using the Help application itself.
cdlHelpIndex	&H3	Displays the index of the specified Help file.  An application should use this value only for a Help file with a single index.
cdlHelpKey	&H101	Displays Help for a particular keyword.  When using this setting, you must also specify a keyword using the HelpKey property.
cdlHelpPartialKey	&H105	Displays the topic found in the keyword list that matches the keyword passed in the dwData parameter if there is one exact match.  If more than one match exists, the Search dialog box with the topics found listed in the Go To list box is displayed.  If no match exists, the Search dialog box is displayed.  To bring up the Search dialog box without passing a keyword, use a long pointer to an empty string.
cdlHelpQuit	&H2	Notifies the Help application that the specified Help file is no longer in use.
cdlHelpSetContents	&H5	Determines which contents topic is displayed when a user presses the F1 key.
cdlHelpSetIndex	&H5	Sets the context specified by the HelpContext property as the current index for the Help file specified by the HelpFile property.  This index remains current until the user accesses a different Help file.  Use this value only for Help files with more than one index.
Remarks

The values for the HelpCommand property constants are listed in the Microsoft CommonDialog Control (MSComDlg) object library in the Object browser.


HelpCommand Property Applies To

CommonDialog Control


See Also

HelpContext Property

HelpKey Property


HelpContext Property (CommonDialog)

See Also 	Applies To

Returns or sets the context ID of the requested Help topic.

Syntax

object.HelpContext [= value]

The HelpContext property syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

value	A string expression specifying the context ID of the requested Help topic.

Remarks

Use this property with the HelpCommand property (set HelpCommand = cdlHelpContext) to specify the Help topic to be displayed.


HelpContext Property Applies To

CommonDialog Control


See Also

HelpCommand Property


HelpKey Property

See Also	Applies To

Returns or sets the keyword that identifies the requested Help topic.

Syntax

object.HelpKey [= string]

The HelpKey property syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

string	A string expression specifying the keyword that identifies the Help topic.

Remarks

Use this property with the HelpCommand property (set HelpCommand = cdlHelpKey) to specify the Help topic to be displayed.


HelpKey Property Applies To

CommonDialog Control


See Also

HelpCommand Property


Icon Property

Applies To

Returns the icon displayed when a form is minimized at run time.

Syntax

object.Icon

The object placeholder represents an object expression that evaluates to an object in the Applies To list.

Remarks

Use this property to specify an icon for any form that the user can minimize at run time.

For example, you can assign an unique icon to a form to indicate the form's function.  Specify the icon by loading it using the Properties window at design time.  The file you load must have the .ICO filename extension and format.  If you don't specify an icon, the Visual Basic default icon for forms is used.

You can use the Visual Basic Icon Library (in the ICONS subdirectory) as a source for icons.  When you create an executable file, you can assign an icon to the application by using the Icon property of any form in that application.

Note   To see a form's icon, the form must be minimized.  The BorderStyle property must be set to either 1 (Fixed Single) or 2 (Sizable).  The MinButton property must be set to True.

At run time, you can assign an object's Icon property to another object's DragIcon or Icon property.  You can also assign an icon returned by the LoadPicture function.  Using LoadPicture without an argument assigns an empty (null) icon to the form, which enables you to draw on the icon at run time.


Icon Property Applies To

Form Object

MDIForm Object


InitDir Property

Applies To

Returns or sets the initial file directory.

Syntax

object.InitDir [= string]

The InitDir property syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

string	A string expression specifying the initial file directory.

Remarks

If this property isn't specified, the current directory is used.


InitDir Property Applies To

CommonDialog Control (File Dialog)


Interval Property

See Also	Applies To

Returns or sets the number of milliseconds between calls to a Timer control's Timer event.

Syntax

object.Interval [= milliseconds]

The Interval property syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

milliseconds	A numeric expression specifying the number of milliseconds, as described in Settings.

Settings

The settings for milliseconds are:

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.

Note   There are a limited number of timers available (16 in the Windows environment).  Trying to start a timer if none is available causes a run-time error.


See Also

Enabled Property


Interval Property Applies To

Timer Control


Left, Top Properties

See Also	Applies To

Left [image] returns or sets the distance between the internal left edge of an object and the left edge of its container.

Top [image] 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 Left and Top property syntaxes have these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

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 a Timer control, these properties aren't available at run time.

For both properties, 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 Form and Printer objects.


 See Also

Left Function

Move Method

ScaleHeight, ScaleWidth Properties

ScaleLeft, ScaleTop Properties

ScaleMode Property


Left, Top Properties Apply To

CheckBox Control

ComboBox Control

CommandButton Control

CommonDialog Control

DirListBox Control

DriveListBox Control

FileListBox Control

Form Object

Frame Control

Grid Control

HScrollBar, VScrollBar Controls

Image Control

Label Control

ListBox Control

MDIForm Object

OptionButton Control

Shape Control

TextBox Control

Timer Control


List Property

See Also	Applies To

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-only at run time for DirListBox, DriveListBox, and FileListBox controls; read/write at run time for ComboBox and ListBox controls.

Syntax

object.List(index) [= string]

The List property syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

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 except the DirListBox, the index of the first item is 0 and the index of the last item is ListCount [image] 1.

For a DirListBox control, the index number sequence is based on the current directories and subdirectories when the control is created at run time.  The directory that is currently expanded is represented using the index [image] 1.  Directories above the currently expanded directory are represented by negative indexes with higher absolute values.  For example, [image] 2 is the parent directory of the directory that is currently expanded and [image] 3 is the directory above that.  Directories below the directory that is currently expanded range from 0 to ListCount [image] 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:

DirListBox [image] contains a list of all directories, using the range -n to ListCount [image] 1.

DriveListBox [image] contains the list of drive connections in effect.

FileListBox [image] contains the list of files in the directory that is currently expanded that match the Pattern property.  The path isn't included.

The List property works in conjunction with the ListCount and ListIndex properties.

For all applicable controls except a DirListBox, enumerating a list from 0 to ListCount -1 returns all items in the list.  For a DirListBox control, enumerating the list from [image] n to ListCount [image] 1 returns a list containing all directories and subdirectories visible from the directory that is currently expanded.  In this case n is the number of directory levels above the directory that is currently expanded.

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.

Using an Option Base = 1 statement in the Declarations section doesn't affect the enumeration of elements in Visual Basic controls.  The first element is always 0.

When the List index is outside the range of actual entries in the list box, a zero-length string ("") is returned.  For example, List(-1) returns a zero-length string for a ComboBox or ListBox control.


See Also

AddItem Method

ListCount Property

ListIndex Property

Pattern Property

RemoveItem Method

Sorted Property


List Property Applies To

ComboBox Control

DirListBox Control

DriveListBox Control

FileListBox Control

ListBox Control


ListCount Property

See Also	Applies To

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 in the Applies To list.

Remarks

ListCount provides specific information for each control:

ComboBox and ListBox controls [image] the number of items in the list.

DirListBox control [image] the number of subdirectories in the current directory.

DriveListBox control [image] the number of drive connections.

FileListBox control [image] the number of files in the current directory that match the Pattern property setting.

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


 See Also

AddItem Method

List Property

ListIndex Property

Pattern Property

RemoveItem Method


ListCount Property Applies To

ComboBox Control

DirListBox Control

DriveListBox Control

FileListBox Control

ListBox Control


ListIndex Property

See Also	Applies To

Returns or sets the index of the currently selected item in the control.  Not available at design time.

Syntax

object.ListIndex [= index]

The ListIndex property syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

index	A numeric expression specifying the index of the current item, as described in Settings.

Settings

The settings for index are:

Setting	Description

1	(Default for ComboBox, DirListBox, and DriveListBox controls) Indicates no item is currently selected.  For a ComboBox control, indicates the user has entered new text into the text box portion.  For a DirListBox control, indicates the index of the current path.  For a DriveListBox control, indicates the index of the current drive when the control is created at run time.

n	(Default for FileListBox and 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.


See Also

AddItem Method

Drive Property

List Property

ListCount Property

Path Property

RemoveItem Method


ListIndex Property Applies To

ComboBox Control

DirListBox Control

DriveListBox Control

FileListBox Control

ListBox Control


Max, Min Properties (CommonDialog)

Applies To

You can set the Max and Min properties for the following:

Font dialog box [image] return or set the smallest and largest font sizes displayed in the Size list box.

Print dialog box [image] return or set the minimum and maximum allowed values for the print range.

Syntax

object.Min [= points]

object.Max [= points]

object.Min [= number ]

object.Max [= number ]

The Max and Min property syntaxes have these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

points	A numeric expression specifying the smallest and largest font sizes.

number	A numeric expression specifying the minimum and maximum page numbers.

Remarks

With the Font dialog box, the LimitSize flag must be set before using these properties.

With the Print dialog box, the Min property determines the smallest number the user can specify in the From text box.  The Max property determines the largest number the user can specify in the To text box.


Max, Min Properties Apply To

CommonDialog Control


MaxButton Property

See Also	Applies To

Returns a value indicating whether a form has a Maximize button.

Syntax

object.MaxButton

The object placeholder represents an object expression that evaluates to an object in the Applies To list.

Settings

The MaxButton property settings are:

Setting	Description

True	(Default) The form has a Maximize button.

False	The form doesn't have a Maximize button.

Remarks

A Maximize button enables users to enlarge a form window to full-screen size.  To display a Maximize button, you must also set the form's BorderStyle property to either 1 (Fixed Single) or 2 (Sizable).

A Maximize button automatically becomes a Restore button when a window is maximized.  Minimizing or restoring a window automatically changes the Restore button back to a Maximize button.

The settings you specify for the MaxButton, MinButton, BorderStyle, and ControlBox properties aren't reflected in the form's appearance until run time.

Note   Maximizing a form at run time generates a Resize event.  The WindowState property reflects the current state of the window.  If you set the WindowState property to 2 (Maximized), the form is maximized independently of whatever settings are in effect for the MaxButton and BorderStyle properties.


See Also

ControlBox Property

MinButton Property


MaxButton Property Applies To

Form Object


MinButton Property

See Also	Applies To

Returns a value indicating whether a form has a Minimize button.

Syntax

object.MinButton

The object placeholder represents an object expression that evaluates to an object in the Applies To list.

Return Values

The MinButton return values are:

Setting	Description

True	(Default) The form has a Minimize button.

False	The form doesn't have a Minimize button.

Remarks

A Minimize button enables users to minimize a form window to an icon.  To display a Minimize button, you must also set the form's BorderStyle property to either 1 (Fixed Single) or 2 (Sizable).

The settings you specify for the MaxButton, MinButton, BorderStyle, and ControlBox properties aren't reflected in the form's appearance until run time.

Note   Minimizing a form to an icon at run time generates a Resize event.  The WindowState property reflects the current state of the window.  If you set the WindowState property to 2 (Maximized), the form is maximized independently of whatever settings are in effect for the MaxButton and BorderStyle properties.


See Also

ControlBox Property

MaxButton Property


MinButton Property Applies To

Form Object


Picture Property

See Also	Applies To

Returns or sets a graphic to be displayed in a control.  For the OLE container control, not available at design time and read-only at run time.

Syntax

object.Picture [= picture]

The Picture property syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

picture	A string expression specifying a file containing a graphic, as described in Settings.

Settings

The settings for picture are:

Setting	Description

(None)	(Default) No picture.

(Bitmap, icon, metafile)	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 LoadPicture function on a bitmap, icon, or metafile.

Remarks

At design time, you can transfer a graphic with the Clipboard using the Copy, Cut, and Paste commands on the Edit menu.  At run time, you can use Clipboard methods such as GetData, SetData, and GetFormat with the nontext Clipboard constants vbCFBitmap, vbCFMetafile, and vbCFDIB, which are listed in the Visual Basic (VB) object library in the Object browser.

When setting the Picture property at design time, the graphic is saved and loaded with the form.  If you create an executable file, the file contains the image.  When you load a graphic at run time, the graphic isn't saved with the application.  Use the SavePicture statement to save a graphic from a form or picture box into a file.

Note   At run time, the Picture property can be set to any other object's DragIcon, Icon, Image, or Picture property, or you can assign it the graphic returned by the LoadPicture function.


See Also

AutoRedraw Property

Icon Property


Picture Property Applies To

Form Object

Image Control

MDIForm Object


PrinterDefault Property

Applies To

Returns or sets an option that determines if the user's selections in the Print dialog box are used to change the system's default printer settings.

Syntax

object.PrinterDefault [= value]

The PrinterDefault property syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

value	A Boolean expression specifying whether the user's selections are used to change the system's default printer settings, as described in Settings.

Settings

The settings for value are:

Setting	Description

True	Any selections the user makes in the Setup portion of the Print dialog box (printer selection, orientation, and so on) are used to change the printer settings in the user's WIN.INI file.  (On the Windows NT operating system, this information is stored in the Registry.)

False	User's selections can't be used to change the system's default printer settings.

Remarks

When PrinterDefault is True, you can write code to print directly to the Visual Basic Printer object.  Otherwise, you must use the graphic device interface (GDI) calls to print to the printer specified by the control's hDC property.

Note   If you've previously printed to the Printer object, make sure you've ended that print job using Printer.EndDoc.  This releases the hDC associated with that printer.  You will get a new hDC for the default printer the next time you print to the Printer object.  If you don't do this, it's possible for the user to select a new printer while the Printer object contains a handle to the old printer.


PrinterDefault Property Applies To

CommonDialog Control


Sorted Property

See Also	Applies To

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 in the Applies To list.

Return Values

The Sorted property return values are:

Setting	Description

True	List items are sorted alphabetically (case-insensitive).

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.


See Also

AddItem Method

List Property

ListCount Property

ListIndex Property

RemoveItem Method


Sorted Property Applies To

ComboBox Control

ListBox Control


TabIndex Property

See Also	Applies To

Returns or sets the tab order of an object within its parent form.

Syntax

object.TabIndex [= index]

The TabIndex property syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

index	An integer from 0 to (n [image] 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.  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.  You can make changes at design time using the Properties window or at run time in code.

All controls except menus and timers are included in the tab order.  At run time, invisible or disabled controls and controls that can't receive the focus (Frame and Label controls) remain in the tab order but are skipped during tabbing.

The TabIndex property isn't affected by the ZOrder method.

Note   A control's tab order doesn't 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 aren't 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.


See Also

TabStop Property

ZOrder Method


TabIndex Property Applies To

CheckBox Control

ComboBox Control

CommandButton Control

DirListBox Control

DriveListBox Control

FileListBox Control

Frame Control

Grid Control

HScrollBar, VScrollBar Controls

Label Control

ListBox Control

OptionButton Control

TextBox Control


Tag Property

See Also	Applies To

Returns or sets an expression that stores any extra data needed for your program.  Unlike other properties, the value of the Tag property isn't used by Visual Basic; you can use this property to identify objects.

Syntax

object.Tag [= expression]

The Tag property syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

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 or MDIForm object 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.


See Also

Name Property


Tag Property Applies To

CheckBox Control

ComboBox Control

CommandButton Control

CommonDialog Control

DirListBox Control

DriveListBox Control

FileListBox Control

Form Object

Frame Control

Grid Control

HScrollBar, VScrollBar Controls

Image Control

Label Control

Line Control

ListBox Control

MDIForm Object

Menu Object

OptionButton Control

Shape Control

TextBox Control

Timer Control


Text Property

See Also	Applies To

ComboBox control (Style property set to 0 [Dropdown Combo] or to 1 [Simple Combo]) and TextBox control [image] returns or sets the text contained in the edit area.

ComboBox control (Style property set to 2 [Dropdown List]) and ListBox control [image] 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.

Grid control [image] returns or sets the text contained in a cell or range of cells.  Not available at design time.

Syntax

object.Text [= string]

The Text property syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

string	A string expression specifying text.

Remarks

At design time only, the defaults for the Text property are:

ComboBox and TextBox controls [image] the control's Name property.

ListBox control [image] 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.

For a Grid control, you can add text to a single cell by setting the Text property.  This property applies to the cell defined by the current values of the Grid control's Row and Col properties.

You can use the Text and FillStyle properties to add the same text to a highlighted range of cells.  When FillStyle = 0, the text assigned to the Text property is added only to the cell defined by the current Row and Col property values.  When FillStyle = 1, the text is added to all cells whose CellSelected property setting is True.

You can also use the Clip property to fill a range of cells.  For example, you might want to paste a large block of information from the Clipboard into a Grid control.


See Also

SelLength, SelStart, SelText Properties

Value Property


Text Property Applies To

ComboBox Control

Grid Control

ListBox Control

TextBox Control


Value Property

See Also	Applies To

CheckBox and OptionButton controls [image] returns or sets the state of the control.

CommandButton control [image] returns or sets a value indicating whether the button is chosen; not available at design time.

Field object [image] returns or sets the content of a field; not available at design time.

HScrollBar and VScrollBar controls (horizontal and vertical scroll bars) [image] 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 Value property syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

value	Value specifying the state, content, or position of a control, as described in Settings.

Settings

The settings for value are:

CheckBox control [image] 0 is Unchecked (default), 1 is Checked, and 2 is Grayed (dimmed).

CommandButton control [image] True indicates the button is chosen; False (default) indicates the button isn't chosen.  Setting the Value property to True in code invokes the button's Click event.

Field object [image] restricted only by the Field data types.

HScrollBar and VScrollBar controls [image] set values between [image] 32,768 and 32,767 to position the scroll box.

OptionButton control [image] True indicates the button is selected; False (default) indicates the button isn't selected.

Remarks

A default property of an object is assumed, and doesn't need to be specified in code.  For example, Field is the default property of any Recordset, and Value is the default property of a Field object.  This makes the two statements below equivalent:

Dn.Fields("PubID").Value = X

Dn.("PubID") = X

The first statement specifies the default properties; the second statement assumes them.


See Also

Max, Min Properties (Scroll Bar)


Value Property Applies To

CheckBox Control

CommandButton Control

HScrollBar, VScrollBar Controls

OptionButton Control


Visible Property

See Also	Applies To

Returns or sets a value indicating whether an object is visible or hidden.

Syntax

object.Visible [= boolean]

The Visible property syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

boolean	A Boolean expression specifying whether the object is visible or hidden.

Settings

The settings for boolean are:

Setting	Description

True	(Default) Object is visible.

False	Object is hidden.

Note   For Visual Basic in-process OLE server (DLL) considerations and restrictions that apply to this topic, see Make OLE DLL File Command.

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.


See Also

Hide Method

Show Method


Visible Property Applies To

CheckBox Control

ComboBox Control

CommandButton Control

DirListBox Control

DriveListBox Control

FileListBox Control

Form Object

Frame Control

Grid Control

HScrollBar, VScrollBar Controls

Image Control

Label Control

Line Control

ListBox Control

MDIForm Object

Menu Object

OptionButton Control

Shape Control

TextBox Control


Activate, Deactivate Events

See Also	Applies To

Activate [image] occurs when a form becomes the active window.

Deactivate [image] occurs when a form 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 in the Applies To list.

Remarks

A form can become active by user action, such as clicking the form, or by using the Show or SetFocus methods in code.

The Activate event can occur only when a form is visible.  For example, a form loaded with the Load statement isn't 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 a form in another application doesn't trigger either event.  The Deactivate event doesn't occur when unloading a form.

The Activate event occurs before the GotFocus event; the LostFocus event occurs before the Deactivate event.

These events occur for MDI child forms only when the focus changes from one child form to another.  In an MDIForm object with two child forms, for example, the child forms receive these events when the focus moves between them.  However, when the focus changes between a child form and a non-MDI child form, the parent MDIForm receives the Activate and Deactivate events.


See Also

GotFocus Event

LostFocus Event

SetFocus Method

Show Method

Visible Property


Activate, Deactivate Events Apply To

Form Object

MDIForm Object


Change Event

See Also	Applies To

Indicates that the contents of a control have changed.  How and when this event occurs varies with the control:

ComboBox [image] 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.

DirListBox [image] changes the selected directory.  Occurs when the user double-clicks a new directory or when you change the Path property setting through code.

DriveListBox [image] changes the selected drive.  Occurs when the user selects a new drive or when you change the Drive property setting through code.

HScrollBar and VScrollBar (horizontal and vertical scroll bars) [image] 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 [image] changes the contents of the Label.  Occurs when a DDE link updates data or when you change the Caption property setting through code.

PictureBox [image] changes the contents of the PictureBox.  Occurs when a DDE link updates data or when you change the Picture property setting through code.

TextBox [image] 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.

Syntax

Private Sub object_Change([index As Integer])

The Change event syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

index	An integer that uniquely identifies a control if it's in a control array.

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.

Change event procedures are also useful for updating properties in file-system controls (DirListBox, DriveListBox, and FileListBox).  For example, you can update the Path property setting for a DirListBox control to reflect a change in a DriveListBox control's Drive property setting.

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.


See Also

Caption Property

Drive Property

KeyDown, KeyUp Events

KeyPress Event

LinkTopic Property

LostFocus Event

Path Property

PathChange Event

PatternChange Event

Picture Property

Style Property

Text Property

Value Property


Change Event Applies To

ComboBox Control

DirListBox Control

DriveListBox Control

HScrollBar, VScrollBar Controls

Label Control

PictureBox Control

TextBox Control


Click Event

See Also	Applies To

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, 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 [image] 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 As Integer])

The Click event syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

index	An integer that uniquely identifies a control if it's in a control array.

Remarks

Typically, you attach a Click event procedure to a CommandButton control, Menu object, or 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 FileListBox, Label, or PictureBox controls, the events occur in this order: MouseDown, MouseUp, and Click.  When you're attaching event procedures for these related events, be sure that their actions don't conflict.  If the order of events is important in your application, test the control to determine the event order.

Note   To distinguish between the left, right, and middle mouse buttons, use the MouseDown and MouseUp events.


See Also

Cancel Property

DblClick Event

Default Property

MouseDown, MouseUp Events

Value Property


Click Event Applies To

CheckBox Control

ComboBox Control

CommandButton Control

DirListBox Control

FileListBox Control

Form Object

Frame Control

Grid Control

Image Control

Label Control

ListBox Control

Menu Object

OptionButton Control

PictureBox Control

TextBox Control


DragDrop Event

See Also	Applies To

Occurs when a drag-and-drop operation is completed as a result of dragging a control over a form or control and releasing the mouse button or using the Drag method with its action argument set to 2 (Drop).

Syntax

Private Sub Form_DragDrop(source As Control, x As Single, y As Single)

Private Sub MDIForm_DragDrop(source As Control, x As Single, y As Single)

Private Sub object_DragDrop([index As Integer,]source As Control, x As Single, y As Single)

The DragDrop event syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

index	An integer that uniquely identifies a control if it's in a control array.

source	The control being dragged.  You can include properties and methods with this argument [image] for example, Source.Visible = 0.

x, y	A number that specifies the current horizontal (x) and vertical (y) position of the mouse pointer within the target form or control.  These coordinates are always expressed in terms of the target's coordinate system as set by the ScaleHeight, ScaleWidth, ScaleLeft, and ScaleTop properties.

Remarks

Use a DragDrop event procedure to control what happens after a drag operation is completed.  For example, you can move the source control to a new location or copy a file from one location to another.

When multiple controls can potentially be used in a source argument:

Use the TypeOf keyword with the If statement to determine the type of control used with source.

Use the control's Tag property to identify a control, and then use a DragDrop event procedure.

Note   Use the DragMode property and Drag method to specify the way dragging is initiated.  Once dragging has been initiated, you can handle events that precede a DragDrop event with a DragOver event procedure.


See Also

Drag Method

DragIcon Property

DragMode Property

DragOver Event

MouseDown, MouseUp Events

MouseMove Event


DragDrop Event Applies To

CheckBox Control

ComboBox Control

CommandButton Control

DirListBox Control

DriveListBox Control

FileListBox Control

Form Object

Frame Control

Grid Control

HScrollBar, VScrollBar Controls

Image Control

Label Control

ListBox Control

MDIForm Object

OptionButton Control

PictureBox Control

TextBox Control


DragOver Event

See Also	Applies To

Occurs when a drag-and-drop operation is in progress.  You can use this event to monitor the mouse pointer as it enters, leaves, or rests directly over a valid target.  The mouse pointer position determines the target object that receives this event.

Syntax

Private Sub Form_DragOver(source As Control, x As Single, y As Single, state As Integer)

Private Sub MDIForm_DragOver(source As Control, x As Single, y As Single, state As Integer)

Private Sub object_DragOver([index As Integer,]source As Control, x As Single, y As Single, state As Integer)

The DragOver event syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

index	An integer that uniquely identifies a control if it's in a control array.

source	The control being dragged.  You can refer to properties and methods with this argument [image] for example, Source.Visible = False.

x, y	A number that specifies the current horizontal (x) and vertical (y) position of the mouse pointer within the target form or control.  These coordinates are always expressed in terms of the target's coordinate system as set by the ScaleHeight, ScaleWidth, ScaleLeft, and ScaleTop properties.

state	An integer that corresponds to the transition state of the control being dragged in relation to a target form or control:

0 = Enter (source control is being dragged within the range of a target).

1 = Leave (source control is being dragged out of the range of a target).

2 = Over (source control has moved from one position in the target to another).

Remarks

Use a DragOver event procedure to determine what happens after dragging is initiated and before a control drops onto a target.  For example, you can verify a valid target range by highlighting the target (set the BackColor or ForeColor property from code) or by displaying a special drag pointer (set the DragIcon or MousePointer property from code).

Use the state argument to determine actions at key transition points.  For example, you might highlight a possible target when state is set to 0 (Enter) and restore the object's previous appearance when state is set to 1 (Leave).

When an object receives a DragOver event when state is set to 0 (Enter):

If the source control is dropped on the object, that object receives a DragDrop event.

If the source control isn't dropped on the object, that object receives another DragOver event when state is set to 1 (Leave).

Note   Use the DragMode property and Drag method to specify the way dragging is initiated.  For suggested techniques with the source argument, see Remarks for the DragDrop event topic.


See Also

Drag Method

DragDrop Event

DragIcon Property

DragMode Property

MouseDown, MouseUp Events

MouseMove Event

MouseUp Event


DragOver Event Applies To

CheckBox Control

ComboBox Control

CommandButton Control

DirListBox Control

DriveListBox Control

FileListBox Control

Form Object

Frame Control

Grid Control

HScrollBar, VScrollBar Controls

Image Control

Label Control

ListBox Control

MDIForm Object

OptionButton Control

PictureBox Control

TextBox Control


DropDown Event

See Also	Applies To

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([index As Integer])

The DropDown event syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

index	An integer that uniquely identifies a control if it's in a control array.

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 [image] for example, if what you want to load into a ComboBox list depends on what the user selects in an OptionButton group.


See Also

Style Property


DropDown Event Applies To

ComboBox Control


GotFocus Event

See Also	Applies To

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( )

Private Sub object_GotFocus([index As Integer])

The GotFocus event syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

index	An integer that uniquely identifies a control if it's in a control array.

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.


See Also

ActiveControl Property

ActiveForm Property

LostFocus Event

SetFocus Method

TabIndex Property

TabStop Property


GotFocus Event Applies To

CheckBox Control

ComboBox Control

CommandButton Control

DirListBox Control

DriveListBox Control

FileListBox Control

Form Object

Grid Control

HScrollBar, VScrollBar Controls

ListBox Control

OptionButton Control

PictureBox Control

TextBox Control


KeyDown, KeyUp Events

See Also	Applies To

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 As Integer, shift As Integer)

Private Sub object_KeyDown([index As Integer,]keycode As Integer, shift As Integer)

Private Sub Form_KeyUp(keycode As Integer, shift As Integer)

Private Sub object_KeyUp([index As Integer,]keycode As Integer, shift As Integer)

The KeyDown and KeyUp event syntaxes have these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

index	An integer that uniquely identifies a control if it's in a control array.

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're 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 aren't 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 declare constants that define the bits within the argument by using constants listed in the Visual Basic (VB) object library in the Object Browser.  The shift 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.  Place the constants at the procedure level or in the Declarations section of a module and use this syntax:

Const Constantname = expression

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

Note   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.


See Also

KeyPreview Property

Operator Precedence

SendKeys Statement


KeyDown, KeyUp Events Apply To

CheckBox Control

ComboBox Control

CommandButton Control

DirListBox Control

DriveListBox Control

FileListBox Control

Form Object

Grid Control

HScrollBar, VScrollBar Controls

ListBox Control

OptionButton Control

PictureBox Control

TextBox Control


KeyPress Event

See Also	Applies To

Occurs when the user presses and releases an ANSI key.

Syntax

Private Sub Form_KeyPress(keyascii As Integer)

Private Sub object_KeyPress([index As Integer,]keyascii As Integer)

The KeyPress event syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

index	An integer that uniquely identifies a control if it's in a control array.

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're 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 doesn't 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.


See Also

Asc Function

Change Event

Character Set (0 - 127)

Chr Function

KeyDown, KeyUp Events

KeyPreview Property

SendKeys Statement


KeyPress Event Applies To

CheckBox Control

ComboBox Control

CommandButton Control

DirListBox Control

DriveListBox Control

FileListBox Control

Form Object

Grid Control

HScrollBar, VScrollBar Controls

ListBox Control

OptionButton Control

PictureBox Control

TextBox Control


LinkClose Event

See Also	Applies To

Occurs when a DDE conversation terminates.  Either application in a DDE conversation may terminate a conversation at any time.

Syntax

Private Sub Form_LinkClose( )

Private Sub MDIForm_LinkClose( )

Private Sub object_LinkClose([index As Integer])

The LinkClose event syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

index	An integer that uniquely identifies a control if it's in a control array.

Remarks

Typically, you use a LinkClose event procedure to notify the user that a DDE conversation has been terminated.  You can also include troubleshooting information on reestablishing a connection or where to go for assistance.  For brief messages, use the MsgBox function.


See Also

LinkError Event

LinkExecute Event

LinkExecute Method

LinkMode Property

LinkNotify Event

LinkOpen Event

LinkTopic Property


LinkClose Event Applies To

Form Object

Label Control

MDIForm Object

PictureBox Control

TextBox Control


LinkError Event

See Also	Applies To

Occurs when there is an error during a DDE conversation.  This event is recognized only as the result of a DDE-related error that occurs when no Visual Basic code is being executed.  The error number is passed as an argument.

Syntax

Private Sub Form_LinkError(linkerr As Integer)

Private Sub MDIForm_LinkError(linkerr As Integer)

Private Sub object_LinkError([index As Integer,]linkerr As Integer)

The LinkError event syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

linkerr	Error number of the DDE-related error, as described in Return Values.

index	An integer that uniquely identifies a control if it's in a control array.

Return Values

The following table lists all error numbers returned for the linkerr argument and a brief explanation of each error:

Value	Description

1	The other application has requested data in the wrong format.  This error may occur several times in succession as Visual Basic tries to find a format the other application recognizes.

6	The destination application attempted to continue a DDE conversation after you set the LinkMode property on your source form to 0 (None).

7	All the source links are in use (there is a limit of 128 links per source).

8	For destination controls:  An automatic link or LinkRequest method failed to update the data in the control.

For source forms:  The destination attempted to poke data to a control and the attempt failed.

11	Not enough memory for DDE.

Remarks

Use a LinkError event procedure to notify the user of the particular error that has occurred.  You can also include code to fix the problem or troubleshooting information on reestablishing a connection or on where to go for assistance.  For brief messages, use the MsgBox function.


See Also

LinkClose Event

LinkExecute Event

LinkExecute Method

LinkItem Property

LinkMode Property

LinkNotify Event

LinkOpen Event

LinkTopic Property


LinkError Event Applies To

Form Object

Label Control

MDIForm Object

PictureBox Control

TextBox Control


LinkExecute Event

See Also	Applies To

Occurs when a command string is sent by a destination application in a DDE conversation.  The destination application expects the source application to perform the operation described by the string.

Syntax

Private Sub object_LinkExecute(cmdstr As String, cancel As Integer)

The LinkExecute event syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

cmdstr	The command string expression sent by the destination application.

cancel	An integer that tells the destination whether the command string was accepted or refused.  Setting cancel to 0 informs the destination that the command string was accepted.  Setting cancel to any nonzero value informs the destination that the command string was rejected.  (The default is set to -1, indicating cancel.)

Remarks

There is no required syntax for cmdstr.  How your application responds to different strings is completely up to you.

If you haven't created a LinkExecute event procedure, Visual Basic rejects command strings from destination applications.


See Also

LinkClose Event

LinkError Event

LinkExecute Method

LinkMode Property

LinkNotify Event

LinkOpen Event

LinkTopic Property


LinkExecute Event Applies To

Form Object

MDIForm Object


LinkNotify Event

See Also	Applies To

Occurs when the source has changed the data defined by the DDE link if the LinkMode property of the destination control is set to 3 (Notify).

Syntax

Private Sub object_LinkNotify([index As Integer])

The LinkNotify event syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

index	An integer that uniquely identifies a control if it's in a control array.

Remarks

Typically, in the LinkNotify event your code notifies the user, gets the new data immediately, or defers getting the data until later.  You can use the LinkRequest method to obtain the new data from the source.


See Also

LinkClose Event

LinkError Event

LinkExecute Method

LinkMode Property

LinkOpen Event

LinkRequest Method

LinkTopic Property


LinkNotify Event Applies To

Label Control

PictureBox Control

TextBox Control


LinkOpen Event

See Also	Applies To

Occurs when a DDE conversation is being initiated.

Syntax

Private Sub Form_LinkOpen(cancel As Integer)

Private Sub MDIForm_LinkOpen(cancel As Integer)

Private Sub object_LinkOpen([index As Integer,]cancel As Integer)

The LinkOpen event syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

cancel	An integer that determines whether the DDE conversation is established or not.  Leaving cancel set to 0 (the default) establishes the conversation.  Setting cancel to any nonzero value refuses the conversation.

index	An integer that uniquely identifies a control if it's in a control array.

Remarks

This event occurs for forms when a destination application is initiating a DDE conversation with the form.  It occurs for controls when a control is initiating a DDE conversation with a source application.


See Also

LinkClose Event

LinkError Event

LinkExecute Event

LinkExecute Method

LinkMode Property

LinkNotify Event

LinkTopic Property


LinkOpen Event Applies To

Form Object

Label Control

MDIForm Object

PictureBox Control

TextBox Control


Load Event

See Also	Applies To

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( )

Private Sub MDIForm_Load( )

Remarks

Typically, you use a Load event procedure to include initialization code for a form [image] for example, code that specifies default settings for controls, indicates contents to be loaded into ComboBox or ListBox controls, and initializes form-level variables.

The Load event occurs after the Initialize event.

When you reference a property of an unloaded form in code, the form is automatically loaded but isn't automatically made visible unless the MDIChild property is set to True.  If an MDIForm object isn't loaded and an MDI child form is loaded, both the MDIForm and the child form are automatically loaded and both become visible.  Other forms aren't shown until you either use the Show method or set the Visible property to True.

The following code in an MDIForm Load event automatically loads an MDI child form (assuming Form1 has its MDIChild property set to True):

Dim NewForm As New Form1

NewForm.Caption = "New Form"	' Loads form by reference.

Because all child forms become visible when loaded, the reference to the Caption property loads the form and makes it visible.

Note   When you create procedures for related events, such as Activate, GotFocus, Paint, and Resize, be sure that their actions don't conflict and that they don't cause recursive events.


See Also

Activate, Deactivate Events

QueryUnload Event

Unload Event


Load Event Applies To

Form Object

MDIForm Object


LostFocus Event

See Also	Applies To

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 Form_LostFocus( )

Private Sub object_LostFocus([index As Integer])

The LostFocus event syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

index	An integer that uniquely identifies a control if it's in a control array.

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.


See Also

ActiveControl Property

ActiveForm Property

GotFocus Event

SetFocus Method

TabIndex Property

TabStop Property


LostFocus Event Applies To

CheckBox Control

ComboBox Control

CommandButton Control

DirListBox Control

DriveListBox Control

FileListBox Control

Form Object

Grid Control

HScrollBar, VScrollBar Controls

ListBox Control

OptionButton Control

PictureBox Control

TextBox Control


MouseDown, MouseUp Events

See Also	Applies To

Occur when the user presses (MouseDown) or releases (MouseUp) a mouse button.

Syntax

Private Sub Form_MouseDown(button As Integer, shift As Integer, x As Single, y As Single)

Private Sub MDIForm_MouseDown(button As Integer, shift As Integer, x As Single, y As Single)

Private Sub object_MouseDown([index As Integer,]button As Integer, shift As Integer, x As Single, y As Single)

Private Sub Form_MouseUp(button As Integer, shift As Integer, x As Single, y As Single)

Private Sub MDIForm_MouseUp(button As Integer, shift As Integer, x As Single, y As Single)

Private Sub object _MouseUp([index As Integer,]button As Integer, shift As Integer, x As Single, y As Single)

The MouseDown and MouseUp event syntaxes have these parts:

Part	Description

object	Returns an object expression that evaluates to an object in the Applies To list.

index	Returns an integer that uniquely identifies a control if it's in a control array.

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.

The following applies to both Click and DblClick events:

If a mouse button is pressed while the pointer is over a form or control, that object "captures" the mouse and receives all mouse events up to and including the last MouseUp event.  This implies that the x, y mouse-pointer coordinates returned by a mouse event may not always be in the internal area of the object that receives them.

If mouse buttons are pressed in succession, the object that captures the mouse after the first press receives all mouse events until all buttons are released.

If you need to test for the button or shift arguments, you can use constants listed in the Visual Basic (VB) object library in the Object Browser to define the bits within the argument:

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.

Note   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; for MouseMove, it indicates the current state of all buttons.


See Also

Click Event

DblClick Event

MouseMove Event

MousePointer Property


MouseDown, MouseUp Events Apply To

CheckBox Control

CommandButton Control

DirListBox Control

FileListBox Control

Form Object

Frame Control

Grid Control

Image Control

Label Control

ListBox Control

MDIForm Object

OptionButton Control

PictureBox Control

TextBox Control


MouseMove Event

See Also	Applies To

Occurs when the user moves the mouse.

Syntax

Private Sub Form_MouseMove(button As Integer, shift As Integer, x As Single, y As Single)

Private Sub MDIForm_MouseMove(button As Integer, shift As Integer, x As Single, y As Single)

Private Sub object_MouseMove([index As Integer,] button As Integer, shift As Integer, x As Single, y As Single)

The MouseMove event syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

index	An integer that uniquely identifies a control if it's in a control array.

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 in the Visual Basic (VB) object library in the Object Browser to define the bits within the argument:

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.


See Also

Click Event

DblClick Event

MouseDown, MouseUp Events

MousePointer Property


MouseMove Event Applies To

CheckBox Control

CommandButton Control

DirListBox Control

FileListBox Control

Form Object

Frame Control

Grid Control

Image Control

Label Control

ListBox Control

MDIForm Object

OptionButton Control

PictureBox Control

TextBox Control


Paint Event

See Also	Applies To

Occurs when part or all of a form or PictureBox control is exposed after it has been moved or enlarged or after a window that was covering the object has been moved.

Syntax

Private Sub Form_Paint( )

Private Sub object_Paint([index As Integer])

The Paint event syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

index	An integer that uniquely identifies a control if it's in a control array.

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 AutoRedraw property is set to True, repainting or redrawing is automatic, so no Paint events are necessary.

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 Image, Label, Line, and Shape controls).

Using a Refresh method in a Resize event procedure forces repainting of the entire object every time a user resizes the form.

Note   Using a Paint event procedure for certain tasks can cause a cascading event.  In general, avoid using a Paint event procedure for the following:

Moving or sizing a form or control.

Changing any variables that affect size or appearance, such as setting an object's BackColor property.

Invoking a Refresh method.

A Resize event procedure may be more appropriate for some of these tasks.


See Also

AutoRedraw Property

Circle Method

ClipControls Property

Line Method

Print Method

PSet Method

Refresh Method

Resize Event


Paint Event Applies To

Form Object

PictureBox Control


PathChange Event

See Also	Applies To

Occurs when the path is changed by setting the FileName or Path property in code.

Syntax

Private Sub object_PathChange([index As Integer])

The PathChange event syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

index	An integer that uniquely identifies a control if it's in a control array.

Remarks

You can use a PathChange event procedure to respond to path changes in a FileListBox control.  When you assign a string containing a new path to the FileName property, the FileListBox control invokes the PathChange event.


See Also

FileName Property

Path Property

Pattern Property

PatternChange Event


PathChange Event Applies To

FileListBox Control


PatternChange Event

See Also	Applies To

Occurs when the file listing pattern, such as "*.*", is changed by setting the FileName or Pattern property in code.

Syntax

Private Sub object_PatternChange([index As Integer])

The PatternChange event syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

index	An integer that uniquely identifies a control if it's in a control array.

Remarks

You can use a PatternChange event procedure to respond to pattern changes in a FileListBox control.  When you assign a string containing a new pattern to the FileName property, the FileListBox invokes the PathChange event.


See Also

FileName Property

Path Property

PathChange Event

Pattern Property


PatternChange Event Applies To

FileListBox Control


QueryUnload Event

See Also	Applies To

Occurs before a form or application closes.  When an MDIForm object closes, the QueryUnload event occurs first for the MDI form and then in all MDI child forms.  If no form cancels the QueryUnload event, the Unload event occurs first in all other forms and then in an MDI form.  When a child form or a Form object closes, the QueryUnload event in that form occurs before the form's Unload event.

Syntax

Private Sub Form_QueryUnload(cancel As Integer, unloadmode As Integer)

Private Sub MDIForm_QueryUnload(cancel As Integer, unloadmode As Integer)

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.

vbFormMDIForm	4	An MDI child form is closing because the MDI form is closing.

These constants are listed in the Visual Basic (VB) object library in the Object Browser.

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.


See Also

Unload Event


QueryUnload Event Applies To

Form Object

MDIForm Object


Resize Event

See Also	Applies To

Occurs when a form is first displayed or the size of an object changes.

Syntax

Private Sub Form_Resize( )

Private Sub object_Resize(height As Single, width As Single)

The Resize event syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

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 don't conflict.

When an OLE container control's SizeMode property is set to 2 (Autosize), the control is automatically sized according to the display size of the object contained in the control.  If the display size of the object changes, the control is automatically resized to fit the object.  When this occurs, the Resize event is invoked for the object before the OLE container control is resized.  The height and width parts indicate the optimal size for displaying the object (this size is determined by the application that created the object).  You can size the control differently by changing the values of the height and width parts in the Resize event.


See Also

AutoRedraw Property

Paint Event

Refresh Method

Show Method


Resize Event Applies To

Form Object

MDIForm Object

PictureBox Control


RowColChange Event

See Also	Applies To

Occurs when the current cell changes to a different cell.

Syntax

Private Sub object_RowColChange ([index As Integer, lastrow As String, lastcol As Integer])

The RowColChange event syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

index	An integer that uniquely identifies a control if it is in a control array.

lastrow	(For DBGrid control) A string expression specifying the previous row position.

lastcol	(For DBGrid control) An integer specifying the previous column position.

Remarks

This event occurs whenever the user clicks a cell other than the current cell or when you programmatically change the current cell within a selection using the Col and Row properties.

The SelChange event also occurs when a user clicks a new cell, but doesn't occur when you programmatically change the selected range without changing the current cell.

For the DBGrid control, the position of the current cell is provided by the Bookmark and ColIndex properties.  The previous cell position is specified by lastrow and lastcol.  If you edit data and then move the current cell position to a new row, the update events for the original row are completed before another cell becomes the current cell.


RowColChange Event Applies To

Grid Control


See Also

Col, Row Properties

SelChange Event


Scroll Event

See Also	Applies To

Occurs when a user repositions the scroll box on a scroll bar or scrolls a DBGrid control horizontally or vertically.

Syntax

Private Sub dbgrid_Scroll([cancel As Integer])

Private Sub object_Scroll( )

The Scroll event syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

cancel	Determines whether the scroll operation succeeds and the DBGrid is repainted, as described in Remarks.

Remarks

For a DBGrid control, this event occurs when the user scrolls the grid horizontally or vertically but before the grid is repainted to display the results of the scroll operation.

Setting cancel to True causes the DBGrid scroll operation to fail, and no repaint operation occurs.  If the Refresh method is invoked within this event, the grid is repainted in its new (scrolled) arrangement even if cancel is set to True.  However, in this case, the grid is repainted again because the scroll operation fails and it snaps back to its previous position.

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 scroll bar changes.

Note   Avoid using a MsgBox statement or function in this event.


See Also

Change Event


Scroll Event Applies To

HScrollBar, VScrollBar Controls


SelChange Event

See Also	Applies To

Occurs when the current range changes to a different cell or range of cells.

Syntax

Private Sub DBGrid_SelChange ([cancel As Integer])

Private Sub object_SelChange( )

The SelChange event syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

cancel	Determines whether the selection reverts to its position before the event occurred.

Remarks

The SelChange event occurs whenever a user clicks a cell other than the current 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.

You can trigger this event in code for a Grid control by changing the selected region using the SelEndCol, SelStartCol, SelEndRow, and SelStartRow properties.  For a DBGrid control, change the selected region using the SelStartCol, SelEndCol, and SelectedRows( ) properties.

The RowColChange event also occurs when a user clicks a new cell but doesn't occur while a user drags the selection across the Grid control or when you programmatically change the selection without moving the current cell.

For the DBGrid control, setting cancel to True causes the selection to revert to the cell or range active before the event occurred.


SelChange Event Applies To

Grid Control


See Also

RowColChange Event

SelEndCol, SelStartCol, SelEndRow, SelStartRow Properties


Timer Event

See Also	Applies To

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([index As Integer])

The Timer event syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

index	An integer that uniquely identifies a control if it's in a control array.

Remarks

Use this event procedure to tell Visual Basic what to do after each Timer control interval has elapsed.  When you're 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.


See Also

Enabled Property

Interval Property

Timer Function


Timer Event Applies To

Timer Control


Unload Event

See Also	Applies To

Occurs when a form is about to be removed from the screen.  When that form is reloaded, the contents of all its controls are reinitialized.  This event is triggered by a user closing the form using the Close command on the Control menu or an Unload statement.

Syntax

Private Sub object_Unload(cancel As Integer)

The Unload event syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

cancel	Integer that determines whether the form is removed from the screen.  If cancel is 0, the form is removed.  Setting cancel to any nonzero value prevents the form from being removed.

Remarks

Setting cancel to any nonzero value prevents the form from being removed, but doesn't stop other events, such as exiting from the Microsoft Windows operating environment.  Use the QueryUnload event to stop exiting from Windows.

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.

The QueryUnload event occurs before the Unload event. The Unload event occurs before the Terminate event.

The Unload event can be caused by using the Unload statement, or by the user choosing the Close command on a form's Control menu, exiting the application with the End Task button on the Windows Task List, closing the MDI form for which the current form is a child form, or exiting the Microsoft Windows operating environment while the application is running.


See Also

Load Event

QueryUnload Event


Unload Event Applies To

Form Object

MDIForm Object


AddItem Method

See Also	Applies To

Adds an item to a ListBox or ComboBox control or adds a row to a Grid control.  Doesn't support named arguments.

Syntax

object.AddItem item, index

The AddItem method syntax has these parts:

Part	Description

object	Required.  An object expression that evaluates to an object in the Applies To list.

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.

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).

A ListBox or ComboBox control that is bound to a Data control doesn't support the AddItem method.


See Also

Clear Method

RemoveItem Method


AddItem Method Applies To

ComboBox Control

Grid Control

ListBox Control


Arrange Method

See Also	Applies To

Arranges the windows or icons within an MDIForm object.  Doesn't support named arguments.

Syntax

object.Arrange arrangement

The Arrange method syntax has these parts:

Part	Description

object	Required.  An object expression that evaluates to an object in the Applies To list.

arrangement	Required.  A value or constant that specifies how to arrange windows or icons on an MDIForm object, as described in Settings.

Settings

The settings for arrangement are:

Constant	Value	Description

vbCascade	0	Cascades all nonminimized MDI child forms.

vbTileHorizontal	1	Tiles all nonminimized MDI child forms horizontally.

vbTileVertical	2	Tiles all nonminimized MDI child forms vertically.

vbArrangeIcons	3	Arranges icons for minimized MDI child forms.

Remarks

These constants are listed in the Visual Basic (VB) object library in the Object Browser.

Windows or icons are arranged even if the MDIForm object is minimized.  Results are visible when the MDIForm is maximized.


See Also

ZOrder Method


Arrange Method Applies To

MDIForm Object


Clear Method (Clipboard, ComboBox, ListBox)

See Also	Applies To

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 in the Applies To list.

Remarks

A ListBox or ComboBox control bound to a Data control doesn't support the Clear method.


See Also

AddItem Method

RemoveItem Method


Clear Method Applies To

ComboBox Control

ListBox Control


Cls Method

See Also	Applies To

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 in the Applies To list.  If object is omitted, the Form with the focus is assumed to be object.

Remarks

Cls 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 aren't affected by Cls.  Graphics and text placed on a Form or PictureBox while the AutoRedraw property is set to True aren't affected if AutoRedraw is set to False before Cls is invoked.  That is, you can maintain text and graphics on a Form or PictureBox by manipulating the AutoRedraw property of the object you're working with.

After Cls is invoked, the CurrentX and CurrentY properties of object are reset to 0.


See Also

AutoRedraw Property

CurrentX, CurrentY Properties


Cls Method Applies To

Form Object

PictureBox Control


Drag Method

See Also	Applies To

Begins, ends, or cancels a drag operation of any control except the Line, Menu, Shape, Timer, or CommonDialog controls.  Doesn't support named arguments.

Syntax

object.Drag action

The Drag method syntax has these parts:

Part	Description

object	Required.  An object expression that evaluates to an object in the Applies To list.  If object is omitted, the object whose event procedure contains the Drag method is assumed.

action	Optional.  A constant or value that specifies the action to perform, as described in Settings.  If action is omitted, the default is to begin dragging the object.

Settings

The settings for action are:

Constant	Value	Description

vbCancel	0	Cancels drag operation.

vbBeginDrag	1	Begins dragging object.

vbEndDrag	2	Ends dragging and drop object.

Remarks

These constants are listed in the Visual Basic (VB) object library in the Object Browser.

Using the Drag method to control a drag-and-drop operation is required only when the DragMode property of the object is set to Manual (0).  However, you can use Drag on an object whose DragMode property is set to Automatic (1 or vbAutomatic).

If you want the mouse pointer to change shape while the object is being dragged, use either the DragIcon or MousePointer property.  The MousePointer property is only used if no DragIcon is specified.

In earlier versions of Visual Basic, Drag was an asynchronous method where subsequent statements were invoked even though the Drag action wasn't finished.  In Visual Basic version 4.0, Drag is a synchronous method in which subsequent statements aren't invoked until the Drag action is finished.


See Also

DragDrop Event

DragIcon Property

DragMode Property

DragOver Event

MousePointer Property


Drag Method Applies To

CheckBox Control

ComboBox Control

CommandButton Control

DirListBox Control

DriveListBox Control

FileListBox Control

Frame Control

Grid Control

HScrollBar Control

Image Control

Label Control

ListBox Control

OptionButton Control

PictureBox Control

TextBox Control

VScrollBar Control


EndDoc Method

See Also

Terminates a print operation sent to the Printer object, releasing the document to the print device or spooler.

Syntax

object.EndDoc

The object placeholder represents an object expression that evaluates to an object in the Applies To list.

Remarks

If EndDoc is invoked immediately after the NewPage method, no additional blank page is printed.


See Also

KillDoc Method

NewPage Method


GetData Method

See Also

Returns a graphic from the Clipboard object.  Doesn't support named arguments.

Syntax

object.GetData (format)

The GetData method syntax has these parts:

Part	Description

object	Required.  An object expression that evaluates to an object in the Applies To list.

format 	Optional.  A constant or value that specifies the Clipboard graphics format, as described in Settings.  Parentheses must enclose the constant or value.  If format is 0 or omitted, GetData automatically uses the appropriate format.

Settings

The settings for format are:

Constant	Value	Description

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.

If no graphic on the Clipboard object matches the expected format, nothing is returned.  If only a color palette is present on the Clipboard object, a minimum size (1 x 1) DIB is created.


See Also

GetFormat Method

GetText Method

SetData Method

SetText Method


GetFormat Method

See Also

Returns an integer indicating whether an item on the Clipboard object matches a specified format.  Doesn't support named arguments.

Syntax

object.GetFormat (format)

The GetFormat method syntax has these parts:

Part	Description

object	Required.  An object expression that evaluates to an object in the Applies To list.

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:

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.


See Also

GetData Method

GetText Method

SetData Method

SetText Method


GetText Method

See Also

Returns a text string from the Clipboard object.  Doesn't support named arguments.

Syntax

object.GetText (format)

The GetText method syntax has these parts:

Part	Description

object	Required.  An object expression that evaluates to an object in the Applies To list.

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:

Constant	Value	Description

vbCFLink	&HBF00	DDE conversation information

vbCFText	1	(Default) Text

Remarks

These constants are listed in the Visual Basic (VB) object library in the Object Browser.

If no text string on the Clipboard object matches the expected format, a zero-length string ("") is returned.


See Also

GetData Method

GetFormat Method

SetData Method

SetText Method


Hide Method

See Also	Applies To

Hides an MDIForm or Form object but doesn't unload it.

Syntax

object.Hide

The object placeholder represents an object expression that evaluates to an object in the Applies To list.  If object is omitted, the form with the focus is assumed to be object.

Remarks

When a form is hidden, it's removed from the screen and its Visible property is set to False.  A hidden form's controls aren't accessible to the user, but they are available to the running Visual Basic application, to other processes that may be communicating with the application through DDE, and to Timer control events.

When a form is hidden, the user can't interact with the application until all code in the event procedure that caused the form to be hidden has finished executing.

If the form isn't loaded when the Hide method is invoked, the Hide method loads the form but doesn't display it.


See Also

Show Method

Visible Property


Hide Method Applies To

Form Object

MDIForm Object


KillDoc Method

See Also

Immediately terminates the current print job.

Syntax

object.KillDoc

The object placeholder represents an object expression that evaluates to an object in the Applies To list.

Remarks

If the operating system's Print Manager is handling the print job (the Print Manager is running and has background printing enabled), KillDoc deletes the current print job and the printer receives nothing.

If Print Manager isn't handling the print job (background printing isn't enabled), some or all of the data may be sent to the printer before KillDoc can take effect.  In this case, the printer driver resets the printer when possible and terminates the print job.


See Also

EndDoc Method


LinkExecute Method

See Also	Applies To

Sends a command string to the source application in a DDE conversation.  Doesn't support named arguments.

Syntax

object.LinkExecute string

The LinkExecute method syntax has these parts:

Part	Description

object	Required.  An object expression that evaluates to an object in the Applies To list.

string	Required.  String expression containing a command recognized by the source application.

Remarks

The actual value of string varies depending on the source application.  For example, Microsoft Excel and Microsoft Word for Windows accept command strings that consist of their macro commands enclosed in square brackets ([ ]).  To see command strings that a source application accepts, consult documentation for that application.


See Also

LinkExecute Event

LinkPoke Method

LinkRequest Method

LinkSend Method


LinkExecute Method Applies To

Label Control

PictureBox Control

TextBox Control


LinkPoke Method

See Also	Applies To

Transfers the contents of a Label, PictureBox, or TextBox control to the source application in a DDE conversation.

Syntax

object.LinkPoke

The object placeholder represents an object expression that evaluates to an object in the Applies To list.

Remarks

The object is the name of a Label, PictureBox, or TextBox involved in a DDE conversation as a destination.  If object is a Label, LinkPoke transfers the contents of the Caption property to the source.  If object is a PictureBox, LinkPoke transfers the contents of the Picture property to the source.  If object is a TextBox, LinkPoke transfers the contents of the Text property to the source.

Typically, information in a DDE conversation flows from source to destination.  However, LinkPoke allows a destination object to supply data to the source.  Not all source applications accept information supplied this way; if the source application doesn't accept the data, an error occurs.


See Also

LinkExecute Method

LinkRequest Method

LinkSend Method


LinkPoke Method Applies To

Label Control

PictureBox Control

TextBox Control


LinkRequest Method

See Also	Applies To

Asks the source application in a DDE conversation to update the contents of a Label, PictureBox, or TextBox control.

Syntax

object.LinkRequest

The object placeholder represents an object expression that evaluates to an object in the Applies To list.

Remarks

The object is the name of a Label, PictureBox, or TextBox involved in a DDE conversation as a destination.  LinkRequest causes the source application to send the most current data to object, updating the Caption property setting if object is a Label, the Picture property setting if object is a PictureBox, or the Text property setting if object is a TextBox.

If the LinkMode property of object is set to Automatic (1 or vbLinkAutomatic), the source application automatically updates object and LinkRequest isn't needed.  If the LinkMode property of object is set to Manual (2 or vbLinkManual), the source application updates object only when LinkRequest is used.  If the LinkMode property of object is set to Notify (3 or vbLinkNotify), the source notifies the destination that data has changed by invoking the LinkNotify event.  The destination must then use LinkRequest to update the data.


See Also

LinkExecute Method

LinkMode Property

LinkNotify Event

LinkPoke Method

LinkSend Method


LinkRequest Method Applies To

Label Control

PictureBox Control

TextBox Control


LinkSend Method

See Also	Applies To

Transfers the contents of a PictureBox control to the destination application in a DDE conversation.

Syntax

object.LinkSend

The object placeholder represents an object expression that evaluates to an object in the Applies To list.

Remarks

The object must be a PictureBox on a Form object that is a source in a DDE conversation.

When other applications establish automatic links with a Form in your application, Visual Basic notifies them when the contents of a TextBox or a Label on the Form change.  However, Visual Basic doesn't automatically notify a DDE destination application when the Picture property setting of a PictureBox on a source Form changes.  Because the amount of data in a graphic can be very large and because it seldom makes sense to update a destination application as each pixel in the picture changes, Visual Basic requires that you use the LinkSend method to explicitly notify DDE destination applications when the contents of a PictureBox changes.


See Also

LinkExecute Method

LinkPoke Method

LinkRequest Method

Picture Property


LinkSend Method Applies To

PictureBox Control


LoadResData Function

See Also

Loads data of several possible types from a resource (.RES) file and returns a Byte array.

Syntax

LoadResData(index, format)

The LoadResData function syntax has these parts:

Part	Description

index	Required.  Integer or string specifying the identifier (ID) of the data in the resource file. The resource whose ID is 1 is reserved for the application icon.

format	Required.  Value that specifies the original format of the data being returned, as described in Settings.  Value can also be the string name of a user-defined resource.

Settings

The settings for format are:

Setting	Description

1	Cursor resource

2	Bitmap resource

3	Icon resource

4	Menu resource

5	Dialog box

6	String resource

7	Font directory resource

8	Font resource

9	Accelerator table

10	User-defined resource

12	Group cursor

14	Group icon

Remarks

The data that LoadResData loads from the resource file can be up to 64K.

Using LoadResData with a bitmap, icon, or cursor resource type returns a string containing the actual bits in the resource.  If you want to use the actual bitmap, icon, or resource, use the LoadResPicture function.

Using LoadResData is useful for localizing a Visual Basic application because the resources that need to be translated are isolated in one resource file and there is no need to access the source code or recompile the application.


See Also

LoadResPicture Function

LoadResString Function


LoadResPicture Function

See Also

Loads a bitmap, icon, or cursor from a resource (.RES) file.

Syntax

LoadResPicture(index, format)

The LoadResPicture function syntax has these parts:

Part	Description

index	Required.  Integer or string specifying the identifier (ID) of the data in the resource file.  The resource whose ID is 1 is reserved for the application icon.

format	Required.  Value or constant that specifies the format of the data being returned, as described in Settings.

Settings

The settings for format are:

Constant	Value	Description

vbResBitmap	0	Bitmap resource

vbResIcon	1	Icon resource

vbResCursor	2	Cursor resource

Remarks

You can use the LoadResPicture function instead of referring to graphics stored in the Picture property of a Form or controls.

Storing bitmaps, icons, or cursors in and accessing them from resource files improves load time because you can load them individually as needed from the resource file, rather than all at once when a Form is loaded.

Using LoadResPicture is useful for localizing a Visual Basic application because the resources that need to be translated are isolated in one resource file and there is no need to access the source code or recompile the application.


See Also

LoadResData Function

LoadResString Function


LoadResString Function

See Also

Loads a string from a resource (.RES) file.

Syntax

LoadResString(index)

The LoadResString function syntax has these parts:

Part	Description

index	Required.  Integer specifying the identifier (ID) of the data in the resource file.  The resource whose ID is 1 is reserved for the application icon.

Remarks

You can use the LoadResString function instead of string literals in your code.  Storing long strings of data in and accessing them from resource files improves load time because you can load them individually as needed from the resource file, rather than all at once when a form is loaded.

Using LoadResString is useful for localizing a Visual Basic application because the resources that need to be translated are isolated in one resource file and there is no need to access the source code or recompile the application.


See Also

LoadResData Function

LoadResPicture Function


Move Method

See Also	Applies To

Moves an MDIForm, Form, or control.  Doesn't support named arguments.

Syntax

object.Move left, top, width, height

The Move method syntax has these parts:

Part	Description

object	Optional.  An object expression that evaluates to an object in the Applies To list.  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 can't 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 (or an MDI child form on an MDIForm object), 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.


See Also

Height Property

Left Property

ScaleHeight Property

ScaleLeft Property

ScaleMode Property

ScaleWidth Property

Top Property

Width Property


Move Method Applies To

CheckBox Control

ComboBox Control

CommandButton Control

DirListBox Control

DriveListBox Control

FileListBox Control

Form Object

Frame Control

Grid Control

HScrollBar Control

Image Control

Label Control

Line Control

ListBox Control

MDIForm Object

OptionButton Control

PictureBox Control

Shape Control

TextBox Control

VScrollBar Control


NewPage Method

See Also

Ends the current page and advances to the next page on the Printer object.

Syntax

object.NewPage

The object placeholder represents an object expression that evaluates to an object in the Applies To list.

Remarks

NewPage advances to the next printer page and resets the print position to the upper-left corner of the new page.  When invoked, NewPage increments the Printer object's Page property by 1.


See Also

EndDoc Method

KillDoc Method

Page Property


PaintPicture Method

See Also	Applies To

Draws the contents of a graphics file (.BMP, .WMF, .EMF, .ICO, or .DIB) on a Form, PictureBox, or Printer.  Doesn't support named arguments.

Syntax

object.PaintPicture picture, x1, y1, width1, height1, x2, y2, width2, height2, opcode

The PaintPicture method syntax has these parts:

Part	Description

object	Optional.  An object expression that evaluates to an object in the Applies To list.  If object is omitted, the Form object with the focus is assumed to be object.

picture	Required.  The source of the graphic to be drawn onto object.  Must be the Picture property of a Form or PictureBox.

x1, y1	Required.  Single-precision 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.  Single-precision 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.  Single-precision 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.  Single-precision 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.  Single-precision 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.  Long value or code that is used only with bitmaps.  It defines a bit-wise operation (for example, Not or Xor operator) that is performed on picture as it's drawn on object.  For a complete list of bit-wise operators, see the BitBlt topic in the Windows SDK Help file (WIN31WH.HLP).

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, don't 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.


 See Also

Scale Method

ScaleMode Property

ScaleX, ScaleY Methods


 PaintPicture Method Applies To

Form Object

PictureBox Control


Point Method

See Also	Applies To

Returns, as a long integer, the red-green-blue (RGB) color of the specified point on a Form or PictureBox.  Doesn't support named arguments.

Syntax

object.Point(x, y)

The Point method syntax has these parts:

Part	Description

object	Optional.  An object expression that evaluates to an object in the Applies To list.  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 or PictureBox.  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.


See Also

Circle Method

Line Method

Print Method

PSet Method


Point Method Applies To

Form Object

PictureBox Control


PopupMenu Method

See Also	Applies To

Displays a pop-up menu on an MDIForm or Form object at the current mouse location or at specified coordinates.  Doesn't support named arguments.

Syntax

object.PopupMenu menuname, flags, x, y, boldcommand

The PopupMenu method syntax has these parts:

Part	Description

object	Optional.  An object expression that evaluates to an object in the Applies To list.  If object is omitted, the form with the focus is assumed to be object.

menuname	Required.  The name of the pop-up menu to be displayed.  The specified menu must have at least one submenu.

flags	Optional.  A value or constant that specifies the location and behavior of a pop-up menu, as described in Settings.

x	Optional.  Specifies the x-coordinate where the pop-up menu is displayed.  If omitted, the mouse coordinate is used.

y	Optional.  Specifies the y-coordinate where the pop-up menu is displayed.  If omitted, the mouse coordinate is used.

boldcommand	Optional.  Specifies the name of a menu control in the pop-up menu to display its caption in bold text.  If omitted, no controls in the pop-up menu appear in bold.

This argument works only for applications running under Windows 95. The application will ignore this argument when running under 16-bit versions of Windows or Windows NT 3.51 and earlier.

Settings

The settings for flags are:

Constant (location)	Value	Description

vbPopupMenuLeftAlign	0	(Default) The left side of the pop-up menu is located at x.

vbPopupMenuCenterAlign	4	The pop-up menu is centered at x.

vbPopupMenuRightAlign	8	The right side of the pop-up menu is located at x.

Constant (behavior)	Value	Description

vbPopupMenuLeftButton	0	(Default) An item on the pop-up menu reacts to a mouse click only when you use the left mouse button.

vbPopupMenuRightButton	2	An item on the pop-up menu reacts to a mouse click when you use either the right or the left mouse button.

Note   The flags parameter has no effect on applications running under Microsoft Windows version 3.0 or earlier.  To specify two flags, combine one constant from each group using the Or operator.

Remarks

These constants are listed in the Visual Basic (VB) object library in the Object Browser.

You specify the unit of measure for the x and y coordinates using the ScaleMode property.  The x and y coordinates define where the pop-up is displayed relative to the specified form.  If the x and y coordinates aren't included, the pop-up menu is displayed at the current location of the mouse pointer.

When you display a pop-up menu, the code following the call to the PopupMenu method isn't executed until the user either chooses a command from the menu (in which case the code for that command's Click event is executed before the code following the PopupMenu statement) or cancels the menu.  In addition, only one pop-up menu can be displayed at a time; therefore, calls to this method are ignored if a pop-up menu is already displayed or if a pull-down menu is open.

A pop-up menu that isn't visible on the menu bar because its Visible property is set to False in the Menu Editor can still be displayed because the Visible property of the specified menu is ignored when Visual Basic displays a pop-up menu.


See Also

MouseDown Event

Or Operator

ScaleMode Property

Visible Property


PopupMenu Method Applies To

Form Object

MDIForm Object


PrintForm Method

See Also	Applies To

Sends a bit-by-bit image of a Form object to the printer.

Syntax

object.PrintForm

The object placeholder represents an object expression that evaluates to an object in the Applies To list.  If object is omitted, the Form with the focus is assumed to be object.

Remarks

PrintForm prints all visible objects and bitmaps of the Form object.  PrintForm also prints graphics added to a Form object or PictureBox control at run time if the AutoRedraw property is True when the graphics are drawn.

The printer used by PrintForm is determined by the operating system's Control Panel settings.


See Also

AutoRedraw Property

EndDoc Method

Print Method

TrackDefault Property


PrintForm Method Applies To

Form Object


RemoveItem Method

See Also	Applies To

Removes an item from a ListBox or ComboBox control or a row from a Grid control.  Doesn't support named arguments.

Syntax

object.RemoveItem index

The RemoveItem method syntax has these parts:

Part	Description

object	Required.  An object expression that evaluates to an object in the Applies To list.

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.


See Also

AddItem Method

Clear Method


RemoveItem Method Applies To

ComboBox Control

Grid Control

ListBox Control


Scale Method

See Also	Applies To

Defines the coordinate system for a Form, PictureBox, or Printer.  Doesn't support named arguments.

Syntax

object.Scale (x1, y1) - (x2, y2)

The Scale method syntax has these parts:

Part	Description

object	Optional.  An object expression that evaluates to an object in the Applies To list.  If object is omitted, the Form object with the focus is assumed to be object.

x1, 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, y2	Optional.  Single-precision values indicating the horizontal and vertical coordinates that define the lower-right corner of object.  Parentheses must enclose the values.  If omitted, the first set of coordinates must also be omitted.

Remarks

The Scale method enables you to reset the coordinate system to any scale you choose.  Scale affects the coordinate system for both run-time graphics statements and the placement of controls.

If you use Scale with no arguments (both sets of coordinates omitted), it resets the coordinate system to twips.


See Also

ScaleHeight, ScaleWidth Properties

ScaleLeft, ScaleTop Properties

ScaleMode Property


Scale Method Applies To

Form Object

PictureBox Control


ScaleX, ScaleY Methods

See Also	Applies To

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.  Doesn't support named arguments.

Syntax

object.ScaleX (width, fromscale, toscale)

object.ScaleY (height, fromscale, toscale)

The ScaleX and ScaleY method syntaxes have these parts:

Part	Description

object	Optional.  An object expression that evaluates to an object in the Applies To list.  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.

Settings

The settings for fromscale and toscale are:

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.

N/A	8	HiMetric.  If fromscale is omitted, HiMetric is assumed as the default.

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.


See Also

ScaleHeight, ScaleWidth Properties

ScaleLeft, ScaleTop Properties

ScaleMode Property


ScaleX, ScaleY Methods Apply To

Form Object

PictureBox Control


SetData Method

See Also

Puts a picture on the Clipboard object using the specified graphic format.  Doesn't support named arguments.

Syntax

object.SetData data, format

The SetData method syntax has these parts:

Part	Description

object	Required.  An object expression that evaluates to an object in the Applies To list.

data	Required.  A graphic to be placed on the Clipboard object.

format 	Optional.  A constant or value that specifies one of the Clipboard object formats recognized by Visual Basic, as described in Settings.  If format is omitted, SetData automatically determines the graphic format.

Settings

The settings for format are:

Constant	Value	Description

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.

You set the graphic that is to be placed onto the Clipboard object with either the LoadPicture function or the Picture property of a Form, Image, or PictureBox.


See Also

GetData Method

GetFormat Method

GetText Method

SetText Method


SetText Method

See Also

Puts a text string on the Clipboard object using the specified Clipboard object format.  Doesn't support named arguments.

Syntax

object.SetText data, format

The SetText method syntax has these parts:

Part	Description

object	Required.  An object expression that evaluates to an object in the Applies To list.

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:

Constant	Value	Description

vbCFLink	&HBF00	DDE conversation information

vbCFRTF	&HBF01	RichText Format

vbCFText	1	(Default) Text

Remarks

These constants are listed in the Visual Basic (VB) object library in the Object Browser.


See Also

GetData Method

GetFormat Method

GetText Method

SetData Method


Show Method

See Also	Applies To

Displays an MDIForm or Form object.  Doesn't support named arguments.

Note	 For Visual Basic in-process OLE server (DLL) considerations and restrictions that apply to this topic, see Make OLE DLL File Command.

Syntax

object.Show style

The Show method syntax has these parts:

Part	Description

object	Optional.  An object expression that evaluates to an object in the Applies To list.  If object is omitted, the form associated with the active form module is assumed to be object.

style	Optional.  Integer that determines if the form is modal or modeless.  If style is 0, the form is modeless; if style is 1, the form is modal.

Remarks

If the specified form isn't loaded when the Show method is invoked, Visual Basic automatically loads it.

When Show displays a modeless form, subsequent code is executed as it's encountered.  When Show displays a modal form, no subsequent code is executed until the form is hidden or unloaded.

When Show displays a modal form, no input (keyboard or mouse click) can occur except to objects on the modal form.  The program must hide or unload a modal form (usually in response to some user action) before input to another form can occur.  An MDIForm can't be modal.

Although other forms in your application are disabled when a modal form is displayed, other applications aren't.

The startup form of an application is automatically shown after its Load event is invoked.


See Also

Activate Event

Hide Method

Visible Property


Show Method Applies To

Form Object

MDIForm Object


ShowColor Method

See Also	Applies To

Displays the CommonDialog control's Color dialog box.

Syntax

object.ShowColor

The object placeholder represents an object expression that evaluates to an object in the Applies To list.


See Also

ShowFont Method

ShowHelp Method

ShowOpen Method

ShowPrinter Method

ShowSave Method


ShowColor Method Applies To

CommonDialog Control


ShowFont Method

See Also	Applies To

Displays the CommonDialog control's Font dialog box.

Syntax

object.ShowFont

The object placeholder represents an object expression that evaluates to an object in the Applies To list.

Remarks

Before you use the ShowFont method, you must set the Flags property of the CommonDialog control to one of three constants or values: cdlCFBoth or &H3, cdlCFPrinterFonts or &H2, or cdlCFScreenFonts or &H1.  If you don't set Flags, a message box is displayed advising you that "There are no fonts installed.", and a run-time error occurs.


See Also

Flags Property (Font Dialog)

ShowColor Method

ShowHelp Method

ShowOpen Method

ShowPrinter Method

ShowSave Method


ShowFont Method Applies To

CommonDialog Control


ShowHelp Method

See Also	Applies To

Runs WINHELP.EXE and displays the Help file you specify.

Syntax

object.ShowHelp

The object placeholder represents an object expression that evaluates to an object in the Applies To list.

Remarks

Before you use the ShowHelp method, you must set the HelpFile and HelpCommand properties of the CommonDialog control to one of their appropriate constants or values.  Otherwise, WINHELP.EXE doesn't display the Help file.


See Also

HelpCommand Property

ShowColor Method

ShowFont Method

ShowOpen Method

ShowPrinter Method

ShowSave Method


ShowHelp Method Applies To

CommonDialog Control


ShowOpen Method

See Also	Applies To

Displays the CommonDialog control's Open dialog box.

Syntax

object.ShowOpen

The object placeholder represents an object expression that evaluates to an object in the Applies To list.


See Also

ShowColor Method

ShowFont Method

ShowHelp Method

ShowPrinter Method

ShowSave Method


ShowOpen Method Applies To

CommonDialog Control


ShowPrinter Method

See Also	Applies To

Displays the CommonDialog control's Printer dialog box.

Syntax

object.ShowPrinter

The object placeholder represents an object expression that evaluates to an object in the Applies To list.


See Also

ShowColor Method

ShowFont Method

ShowHelp Method

ShowOpen Method

ShowSave Method


ShowPrinter Method Applies To

CommonDialog Control


ShowSave Method

See Also	Applies To

Displays the CommonDialog control's Save As dialog box.

Syntax

object.ShowSave

The object placeholder represents an object expression that evaluates to an object in the Applies To list.


See Also

ShowColor Method

ShowFont Method

ShowHelp Method

ShowOpen Method

ShowPrinter Method


ShowSave Method Applies To

CommonDialog Control


TextHeight Method

See Also	Applies To

Returns the height of a text string as it would be printed in the current font of a Form, PictureBox, or Printer.  Doesn't support named arguments.

Syntax

object.TextHeight(string)

The TextHeight method syntax has these parts:

Part	Description

object	Optional.  An object expression that evaluates to an object in the Applies To list.  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.


See Also

FontSize Property

Scale Method

ScaleMode Property

TextWidth Method


TextHeight Method Applies To

Form Object

PictureBox Control


TextWidth Method

See Also	Applies To

Returns the width of a text string as it would be printed in the current font of a Form, PictureBox, or Printer.  Doesn't support named arguments.

Syntax

object.TextWidth(string)

The TextWidth method syntax has these parts:

Part	Description

object	Optional.  An object expression that evaluates to an object in the Applies To list.  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 height 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.


See Also

FontSize Property

Scale Method

ScaleMode Property

TextHeight Method


TextWidth Method Applies To

Form Object

PictureBox Control


ZOrder Method

See Also	Applies To

Places a specified MDIForm, Form, or control at the front or back of the z-order within its graphical level.  Doesn't support named arguments.

Syntax

object.ZOrder position

The ZOrder method syntax has these parts:

Part	Description

object	Optional.  An object expression that evaluates to an object in the Applies To list.  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.

Within an MDIForm object, ZOrder sends MDI child forms to either the front or the back of the MDI client area, depending on the value of position.  For an MDIForm or Form object, ZOrder sends the form to either the front or the back of the screen, depending on the value of position.  As a result, forms can be displayed in front of or behind other running applications.

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.


See Also

Arrange Method


ZOrder Method Applies To

App Object

CheckBox Control

ComboBox Control

CommandButton Control

DirListBox Control

DriveListBox Control

FileListBox Control

Form Object

Frame Control

Grid Control

HScrollBar Control

Image Control

Label Control

Line Control

ListBox Control

MDIForm Object

OptionButton Control

PictureBox Control

Shape Control

TextBox Control

VScrollBar Control


App Object

See Also	Properties

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

Note	 For Visual Basic in-process OLE server (DLL) considerations and restrictions that apply to this topic, see Make OLE DLL File Command.

Syntax

App

Remarks

The App object has no events or methods.


See Also

HelpContextID Property


App Object Properties

Path Property

PrevInstance Property

StartMode Property

Title Property


CheckBox Control

See Also	Properties	Methods 	Events

A CheckBox control displays an X when selected; the X disappears when the CheckBox is cleared.  Use this control to give the user a True/False or Yes/No option.  You can use CheckBox controls in groups to display multiple choices from which the user can select one or more.

Syntax

CheckBox

Remarks

CheckBox and OptionButton controls function similarly but with an important difference: Any number of CheckBox controls on a form can be selected at the same time.  In contrast, only one OptionButton in a group can be selected at any given time.

To display text next to the CheckBox, set the Caption property.  Use the Value property to determine the state of the control [image] selected, cleared, or unavailable.


See Also

Caption Property

Value Property


CheckBox Control Properties

Alignment Property

Appearance Property

BackColor Property

Caption Property

Container Property

DragIcon Property

DragMode Property

Enabled Property

Font Property

FontBold Property

FontItalic Property

FontName Property

FontSize Property

FontStrikethru Property

FontUnderline Property

ForeColor Property

Height Property

HelpContextID Property

hWnd Property

Index Property

Left Property

MousePointer Property

Name Property

Parent Property

TabIndex Property

TabStop Property

Tag Property

Top Property

Value Property

Visible Property

Width Property


CheckBox Control Methods

Drag Method

Move Method

Refresh Method

SetFocus Method

ZOrder Method


CheckBox Control Events

Click Event

DragDrop Event

DragOver Event

GotFocus Event

KeyDown Event

KeyPress Event

KeyUp Event

LostFocus Event

MouseDown Event

MouseMove Event

MouseUp Event


ComboBox Control

See Also	Properties	Methods	Events

A ComboBox control combines the features of a TextBox control and a ListBox control [image] users can enter information in the text box portion or select an item from the list box portion of the control.

Syntax

ComboBox


See Also

ListBox Control

TextBox Control


ComboBox Control Properties

Appearance Property

BackColor Property

Container Property

DragIcon Property

DragMode Property

Enabled Property

Font Property

FontBold Property

FontItalic Property

FontName Property

FontSize Property

FontStrikethru Property

FontUnderline Property

ForeColor Property

Height Property

HelpContextID Property

hWnd Property

Index Property

ItemData Property

Left Property

ListCount Property

ListIndex Property

List Property

MouseIcon Property

MousePointer Property

Name Property

NewIndex Property

Parent Property

SelLength Property

SelStart Property

SelText Property

Sorted Property

Style Property

TabIndex Property

TabStop Property

Tag Property

Text Property

Top Property

Visible Property

Width Property


ComboBox Control Methods

AddItem Method

Clear Method

Drag Method

Move Method

Refresh Method

RemoveItem Method

SetFocus Method

ZOrder Method


ComboBox Control Events

Change Event

Click Event

DblClick Event

DragDrop Event

DragOver Event

DropDown Event

GotFocus Event

KeyDown Event

KeyPress Event

KeyUp Event

LostFocus Event


CommandButton Control

See Also	Properties	Methods 	Events

Use a CommandButton control to begin, interrupt, or end a process.  When chosen, a CommandButton appears pushed in and so is sometimes called a push button.

Syntax

CommandButton

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.


See Also

Cancel Property

Caption Property

Default Property


CommandButton Control Properties

Appearance Property

BackColor Property

Cancel Property

Caption Property

Container Property

Default Property

DragIcon Property

DragMode Property

Enabled Property

Font Property

FontBold Property

FontItalic Property

FontName Property

FontSize Property

FontStrikethru Property

FontUnderline Property

Height Property

HelpContextID Property

hWnd Property

Index Property

Left Property

MouseIcon Property

MousePointer Property

Name Property

Parent Property

TabIndex Property

TabStop Property

Tag Property

Top Property

Value Property

Visible Property

Width Property


CommandButton Control Methods

Drag Method

Move Method

Refresh Method

SetFocus Method

ZOrder Method


CommandButton Control Events

Click Event

DragDrop Event

DragOver Event

GotFocus Event

KeyDown Event

KeyPress Event

KeyUp Event

LostFocus Event

MouseDown Event

MouseMove Event

MouseUp Event


CommonDialog Control

See Also	Properties	Methods

The CommonDialog control provides a standard set of dialog boxes for operations such as opening, saving, and printing files or selecting colors and fonts.

Syntax

CommonDialog

Remarks

The CommonDialog control provides an interface between Visual Basic and the routines in the Microsoft Windows dynamic-link library COMMDLG.DLL.  To create a dialog box using this control, COMMDLG.DLL must be in your Microsoft Windows SYSTEM directory.

You create dialog boxes for your application by adding the CommonDialog control to a form and setting its properties.  The type of dialog box displayed is determined by the methods of the control.  At run time, a dialog box is displayed when the appropriate method is invoked; at design time, the CommonDialog control is displayed as an icon on a form.  This icon can't be sized.

Under Microsoft Windows 95, the CommonDialog control automatically provides context sensitive help on the interface of the dialog boxes by clicking:

The What's This help button in the title bar then clicking the item for which you want more information.

The right mouse button over the item for which you want more information then selecting the What's This command in the displayed context menu.

The operating system provides the text shown in the Windows 95 Help popup.  However, no topic exists for the Help button displayed with the CommonDialog control by setting the Flags property.

Note   You can't specify where a dialog box is displayed.

Distribution Note   The CommonDialog control is a custom control, which is a separate file with an .OCX extension.  To use the CommonDialog control in your application, you must add the COMDLG16.OCX or COMDLG32.OCX file to the project.  To automatically include this custom control in new projects, add the file you need to AUTOLOAD.VBP.  When distributing your application, install the .OCX file in the user's Microsoft Windows SYSTEM directory.  For more information on how to add a custom control to a project, see the Programmer's Guide.


See Also

Call Statement


CommonDialog Control Properties

Color Dialog Properties

File Dialog Properties

Font Dialog Properties

Print Dialog Properties


Color Dialog Box Properties (CommonDialog)

Action Property

CancelError Property

Color Property

Flags Property

HelpCommand Property

HelpContext Property

HelpKey Property

Object Property


File Dialog Box Properties (CommonDialog)

Action Property

CancelError Property

DefaultExt Property

DialogTitle Property

FileName Property

FileTitle Property

Filter Property

FilterIndex Property

Flags Property

HelpCommand Property

HelpContext Property

HelpKey Property

InitDir Property

MaxFileSize Property

Object Property


Font Dialog Box Properties (CommonDialog)

Action Property

CancelError Property

Flags Property

FontBold Property

FontItalic Property

FontName Property

FontSize Property

FontStrikethru Property

FontUnderline Property

HelpCommand Property

HelpContext Property

HelpKey Property

Max Property

Min Property

Object Property


Print Dialog Box Properties (CommonDialog)

Action Property

CancelError Property

Copies Property

Flags Property

FromPage Property

hDC Property

HelpCommand Property

HelpContext Property

HelpKey Property

Max Property

MaxFileSize Property

Min Property

Object Property

PrinterDefault Property

ToPage Property


CommonDialog Control Methods

ShowColor Method

ShowFont Method

ShowHelp Method

ShowOpen Method

ShowPrinter Method

ShowSave Method


Controls Collection

See Also	Properties

A collection whose elements represent each control on a form, including elements of control arrays.  The Controls collection has a single property, Count, that specifies the number of elements in an array.

Syntax

object.Controls(index)

The Controls collection syntax has these parts:

Part	Description

object	An object expression that evaluates to a Form object.

index	An integer with a range from 0 to Forms.Count - 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.  If you include object, you can omit the Controls keyword.  For example, the following two lines of code have the same effect:

MyForm.Controls(6).Top = MyForm.Controls(5).Top + increment

MyForm(6).Top = MyForm(5).Top + increment

You can pass Controls(index) to a function whose argument is specified as a Controls class.


See Also

Forms Object, Forms Collection


Controls Collection Properties

Count Property


DirListBox Control

See Also	Properties	Methods 	Events

A DirListBox control displays directories and paths at run time.  Use this control to display a hierarchical list of directories.  You can create dialog boxes that, for example, enable a user to open a file from a list of files in all available directories.

Syntax

DirListBox

Remarks

Set the List, ListCount, and ListIndex properties to enable a user to access items in a list.  If you also display the DriveListBox and FileListBox controls, you can write code to synchronize them with the DirListBox control and with each other.


See Also

DriveListBox Control

FileListBox Control

List Property

ListCount Property

ListIndex Property


DirListBox Control Properties

Appearance Property

BackColor Property

Container Property

DragIcon Property

DragMode Property

Enabled Property

Font Property

FontBold Property

FontItalic Property

FontName Property

FontSize Property

FontStrikethru Property

FontUnderline Property

ForeColor Property

Height Property

HelpContextID Property

hWnd Property

Index Property

Left Property

List Property

ListCount Property

ListIndex Property

MouseIcon Property

MousePointer Property

Name Property

Parent Property

Path Property

TabIndex Property

TabStop Property

Tag Property

Top Property

Visible Property

Width Property


DirListBox Control Methods

Drag Method

Move Method

Refresh Method

SetFocus Method

ZOrder Method


DirListBox Control Events

Change Event

Click Event

DragDrop Event

DragOver Event

GotFocus Event

KeyDown Event

KeyPress Event

KeyUp Event

LostFocus Event

MouseDown Event

MouseMove Event

MouseUp Event


DriveListBox Control

See Also	Properties	Methods 	Events

A DriveListBox control enables a user to select a valid disk drive at run time.  Use this control to display a list of all the valid drives in a user's system.  You can create dialog boxes that enable the user to open a file from a list of files on a disk in any available drive.

Syntax

DriveListBox

Remarks

Set the List, ListCount, and ListIndex properties to enable a user to access items in the list.  If you also display the DirListBox and FileListBox controls, you can write code to synchronize them with the DriveListBox control and with each other.


See Also

DirListBox Control

FileListBox Control

List Property

ListCount Property

ListIndex Property


DriveListBox Control Properties

Appearance Property

BackColor Property

Container Property

DragIcon Property

DragMode Property

Drive Property

Enabled Property

Font Property

FontBold Property

FontItalic Property

FontName Property

FontSize Property

FontStrikethru Property

FontUnderline Property

ForeColor Property

Height Property

HelpContextID Property

hWnd Property

Index Property

Left Property

List Property

ListCount Property

ListIndex Property

MouseIcon Property

MousePointer Property

Name Property

Parent Property

TabIndex Property

TabStop Property

Tag Property

Top Property

Visible Property

Width Property


DriveListBox Control Methods

Drag Method

Move Method

Refresh Method

SetFocus Method

ZOrder Method


DriveListBox Control Events

Change Event

DragDrop Event

DragOver Event

GotFocus Event

KeyDown Event

KeyPress Event

KeyUp Event

LostFocus Event


FileListBox Control

See Also	Properties	Methods 	Events

A FileListBox control locates and lists files in the directory specified by the Path property at run time.  Use this control to display a list of files selected by file type.  You can create dialog boxes in your application that, for example, enable the user to select a file or group of files.

Syntax

FileListBox

Remarks

Set the List, ListCount, and ListIndex properties to enable a user to access items in the list.  If you also display the DirListBox and DriveListBox controls, you can write code to synchronize them with the FileListBox control and with each other.


See Also

DirListBox Control

DriveListBox Control

List Property

ListCount Property

ListIndex Property

Path Property


FileListBox Control Properties

Appearance Property

Archive Property

BackColor Property

Container Property

DragIcon Property

DragMode Property

Enabled Property

FileName Property

Font Property

FontBold Property

FontItalic Property

FontName Property

FontSize Property

FontStrikethru Property

FontUnderline Property

ForeColor Property

Height Property

HelpContextID Property

Hidden Property

hWnd Property

Index Property

Left Property

List Property

ListCount Property

ListIndex Property

MouseIcon Property

MousePointer Property

MultiSelect Property

Name Property

Normal Property

Parent Property

Path Property

Pattern Property

ReadOnly Property

Selected Property

System Property

TabIndex Property

TabStop Property

Tag Property

Top Property

TopIndex Property

Visible Property

Width Property


FileListBox Control Methods

Drag Method

Move Method

Refresh Method

SetFocus Method

ZOrder Method


FileListBox Control Events

Click Event

DblClick Event

DragDrop Event

DragOver Event

GotFocus Event

KeyDown Event

KeyPress Event

KeyUp Event

LostFocus Event

MouseDown Event

MouseMove Event

MouseUp Event

PathChange Event

PatternChange Event


Form Object, Forms Collection

See Also	Properties	Methods 	Events

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

A Forms collection is a collection whose elements represent each loaded form in an application.  The collection includes the application's MDI form, MDI child forms, and non-MDI forms.  The Forms collection has a single property, Count, that specifies the number of elements in the collection.

Note	 For Visual Basic in-process OLE server (DLL) considerations and restrictions that apply to this topic, see Make OLE DLL File Command.

Syntax

Form

Forms(index)

The placeholder index represents an integer with a range from 0 to Forms.Count - 1.

Remarks

You can use the Forms collection to iterate through all loaded forms in an application.  It identifies an intrinsic global variable named Forms.  You can pass Forms(index) to a function. whose argument is specified as a Forms class.

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.

A special kind of form, the MDI form, can contain other forms called MDI child forms.  An MDI form is created with the MDI Form command on the Insert menu; an MDI child form is created by choosing New Form from the File menu and then setting the MDIChild property to True.

You can create multiple instances of forms in code by using the New keyword in Dim, Set, and Static statements.

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, Control-menu box, Maximize button, and Minimize button, delete any text from the form's Caption property, and set the form's ControlBox, MaxButton, and MinButton properties to False.

Form is an object data type.  You can declare variables as type Form before setting them to an instance of a type of form that was declared at design time.  Similarly, you can pass an argument to a procedure as type Form.

Forms also can act as sources in a DDE conversation, with a Label, PictureBox, or TextBox control furnishing the data.

You can access the collection of controls on a Form using the Controls collection.  For example, to hide all the controls on an Form you can use code similar to the following:

For Each Control in Form1.Controls

Control.Visible = False

Next Control


See Also

Controls Collection

Count Property

Hide Method

Label Control

MDIChild Property

MDIForm Object

Move Method

PictureBox Control

TextBox Control


Form Object, Forms Collection Properties

Legend

ActiveControl Property

ActiveForm Property

AutoRedraw Property

Appearance Property

BackColor Property

BorderStyle Property

Caption Property

ClipControls Property

ControlBox Property

Count Property

CurrentX Property

CurrentY Property

DrawMode Property

DrawStyle Property

DrawWidth Property

Enabled Property

FillColor Property

FillStyle Property

Font Property

FontBold Property

FontItalic Property

FontName Property

FontSize Property

FontStrikethru Property

FontTransparent Property

FontUnderline Property

ForeColor Property

hDC Property

Height Property

HelpContextID Property

hWnd Property

Icon Property

Image Property

KeyPreview Property

Left Property

LinkMode Property

LinkTopic Property

MaxButton Property

MDIChild Property

MinButton Property

MouseIcon Property

MousePointer Property

Name Property

Picture Property

ScaleHeight Property

ScaleLeft Property

ScaleMode Property

ScaleTop Property

ScaleWidth Property

Tag Property

Top Property

Visible Property

Width Property

WindowState Property


Form Object, Forms Collection Methods

Legend

Circle Method

Cls Method

Hide Method

Item Method

Line Method

Move Method

PaintPicture Method

Point Method

PopupMenu Method

Print Method

PrintForm Method

PSet Method

Refresh Method

Scale Method

ScaleX Method

ScaleY Method

SetFocus Method

Show Method

TextHeight Method

TextWidth Method

ZOrder Method


Form Object, Forms Collection Events

Activate Event

Click Event

DblClick Event

Deactivate Event

DragDrop Event

DragOver Event

GotFocus Event

KeyDown Event

KeyPress Event

KeyUp Event

LinkClose Event

LinkError Event

LinkExecute Event

LinkOpen Event

Load Event

LostFocus Event

MouseDown Event

MouseMove Event

MouseUp Event

Paint Event

QueryUnload Event

Resize Event

Unload Event


Frame Control

See Also	Properties	Methods 	Events

A Frame control provides an identifiable grouping for controls.  You can also use a Frame to subdivide a form functionally [image] for example, to separate groups of OptionButton controls.

Syntax

Frame

Remarks

To group controls, first draw the Frame control, and then draw the controls inside the Frame.  This enables you to move the Frame and the controls it contains together.  If you draw a control outside the Frame and then try to move it inside, 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.


See Also

OptionButton Control


Frame Control Properties

Appearance Property

BackColor Property

Caption Property

ClipControls Property

Container Property

DragIcon Property

DragMode Property

Enabled Property

Font Property

FontBold Property

FontItalic Property

FontName Property

FontSize Property

FontStrikethru Property

FontUnderline Property

ForeColor Property

Height Property

HelpContextID Property

hWnd Property

Index Property

Left Property

MouseIcon Property

MousePointer Property

Name Property

Parent Property

TabIndex Property

Tag Property

Top Property

Visible Property

Width Property


Frame Control Methods

Drag Method

Move Method

Refresh Method

ZOrder Method


Frame Control Events

Click Event

DblClick Event

DragDrop Event

DragOver Event

MouseDown Event

MouseMove Event

MouseUp Event


Grid Control

See Also	Properties	Methods 	Events

A Grid control displays a series of rows and columns.  The intersection of a row and column is a cell.  You can read and set the contents of each cell in code.

Syntax

Grid

Remarks

You can put either text or a picture in any cell of a Grid.

The Row and Col properties specify the current cell in a Grid.  You can specify the current cell in code, or a 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 the text in a cell is too long to be displayed in the cell, the text wraps to the next line within the same cell.  To display the wrapped text, you must 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.  This control can't have more than 16352 rows and 5450 columns.

When a new element of a control array is loaded at run time, the new element doesn't inherit the original control's run-time properties.

Distribution Note   The Grid control is a custom control, which is a separate file with an .OCX extension.  To use the Grid control in your application, you must add the GRID16.OCX or GRID32.OCX file to the project.  To automatically include this custom control in new projects, add the file you need to AUTOLOAD.VBP.  When distributing your application, install the custom control file in the user's Microsoft Windows SYSTEM directory.  For more information on how to add a custom control to a project, see the Programmer's Guide.


See Also

Col Property

ColWidth Property

Row Property

RowHeight Property

Text Property


Grid Control Properties

BackColor Property

BorderStyle Property

CellSelected Property

Clip Property

Col Property

ColAlignment Property

ColIsVisible Property

Cols Property

ColWidth Property

Container Property

DragIcon Property

DragMode Property

Enabled Property

FillStyle Property

FixedAlignment Property

FixedCols Property

FixedRowsProperty

Font Property

FontBold Property

FontItalic Property

FontName Property

FontSize Property

FontStrikethru Property

FontUnderline Property

ForeColor Property

GridLines Property

GridLineWidth Property

Height Property

HelpContextID Property

HighLight Property

hWnd Property

Index Property

Left Property

LeftCol Property

MouseIcon Property

MousePointer Property

Name Property

Object Property

Parent Property

Picture Property

Row Property

RowHeight Property

Rows Property

ScrollBars Property

SelEndCol Property

SelEndRow Property

SelStartCol Property

SelStartRow Property

TabIndex Property

TabStop Property

Tag Property

Text Property

Top Property

TopRow Property

Visible Property

Width Property


Grid Control Methods

AddItem Method

Drag Method

Move Method

Refresh Method

RemoveItem Method

SetFocus Method

ZOrder Method


Grid Control Events

Click Event

DblClick Event

DragDrop Event

DragOver Event

GotFocus Event

KeyDown Event

KeyPress Event

KeyUp Event

LostFocus Event

MouseDown Event

MouseMove Event

MouseUp Event

RowColChange Event

SelChange Event


HScrollBar, VScrollBar Controls

See Also	Properties	Methods 	Events

Scroll bars provide easy navigation through a long list of items or a large amount of information.  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 [image] for example, to control the volume of a computer game or to view the time elapsed in a timed process.

Syntax

HScrollBar

VScrollBar

Remarks

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.

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.


See Also

LargeChange Property

Max Property

Min Property

SmallChange Property

Value Property


HScrollBar Control, VScrollBar Control Properties

Appearance Property

Container Property

DragIcon Property

DragMode Property

Enabled Property

Height Property

HelpContextID Property

hWnd Property

Index Property

LargeChange Property

Left Property

Max Property

Min Property

MouseIcon Property

MousePointer Property

Name Property

Parent Property

SmallChange Property

TabIndex Property

TabStop Property

Tag Property

Top Property

Value Property

Visible Property

Width Property


HScrollBar Control, VScrollBar Control Methods

Drag Method

Move Method

Refresh Method

SetFocus Method

ZOrder Method


HScrollBar Control, VScrollBar Control Events

Change Event

DragDrop Event

DragOver Event

GotFocus Event

KeyDown Event

KeyPress Event

KeyUp Event

LostFocus Event

Scroll Event


Image Control

See Also	Properties	Methods 	Events

Use the Image control to display a graphic.

Syntax

Image

Remarks

The Image control uses fewer system resources and repaints faster than a PictureBox control, but it supports only a subset of the PictureBox properties, events, and methods.  Use the Stretch property to determine whether the graphic is scaled to fit the control or vice versa.  Although you can place an Image control within a container, an Image control can't act as a container.


See Also

PictureBox Control

Stretch Property


Image Control Properties

Appearance Property

BorderStyle Property

Container Property

DragIcon Property

DragMode Property

Enabled Property

Height Property

Index Property

Left Property

MouseIcon Property

MousePointer Property

Name Property

Parent Property

Picture Property

Stretch Property

Tag Property

Top Property

Visible Property

Width Property


Image Control Methods

Drag Method

Move Method

Refresh Method

ZOrder Method


Image Control Events

Click Event

DblClick Event

DragDrop Event

DragOver Event

MouseDown Event

MouseMove Event

MouseUp Event


Label Control

See Also	Properties	Methods 	Events

A Label control is a graphical control you can use to display text that a user can't change directly.

Syntax

Label

Remarks

You can 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 commit a change, you can display a processing-status message in a Label.  You can also use a Label to identify a control, such as a TextBox control, that doesn't have its own Caption property.

Set the AutoSize and WordWrap properties if you want the Label to properly display variable-length lines or varying numbers of lines.

A Label control can also act as a destination in a DDE conversation.  Set the LinkTopic property to establish a link, set the LinkItem property to specify an item for the conversation, and set the LinkMode property to activate the link.  When these properties have been set, Visual Basic attempts to initiate the conversation and displays a message if it's unable to do so.

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.


See Also

AutoSize Property

Caption Property

LinkItem Property

LinkMode Property

LinkTopic Property

TabIndex Property

TextBox Control

WordWrap Property


Label Control Properties

Alignment Property

Appearance Property

AutoSize Property

BackColor Property

BackStyle Property

BorderStyle Property

Caption Property

Container Property

DragMode Property

Enabled Property

Font Property

FontBold Property

FontItalic Property

FontName Property

FontSize Property

FontStrikethru Property

FontUnderline Property

ForeColor Property

Height Property

Index Property

Left Property

LinkItem Property

LinkMode Property

LinkTimeout Property

LinkTopic Property

MouseIcon Property

MousePointer Property

Name Property

Parent Property

TabIndex Property

Tag Property

Top Property

UseMnemonic Property

Visible Property

Width Property

WordWrap Property


Label Control Methods

Drag Method

LinkExecute Method

LinkPoke Method

LinkRequest Method

Move Method

Refresh Method

ZOrder Method


Label Control Events

Change Event

Click Event

DblClick Event

DragDrop Event

DragOver Event

LinkClose Event

LinkError Event

LinkNotify Event

LinkOpen Event

MouseDown Event

MouseMove Event

MouseUp Event


Line Control

See Also	Properties	Methods

A Line control is a graphical control displayed as a horizontal, vertical, or diagonal line.

Syntax

Line

Remarks

You can use a Line control at design time to draw lines on forms.  At run time, you can use a Line control instead of, or in addition to, the Line method.  Lines drawn with the Line control remain on the form even if the AutoRedraw property setting is False.  Line controls can be displayed on forms, in picture boxes, and in frames.  You can't use the Move method to move a Line control at run time, but you can move or resize it by altering its X1, X2, Y1, and Y2 properties.  The effect of setting the BorderStyle property depends on the setting of the BorderWidth property.  If BorderWidth isn't 1 and BorderStyle isn't 0 or 6, BorderStyle is set to 1.


See Also

BorderStyle Property

BorderWidth Property

Frame Control

Line Method

Move Method

PictureBox Control


Line Control Properties

Appearance Property

BorderColor Property

BorderStyle Property

BorderWidth Property

Container Property

DrawMode Property

Index Property

Name Property

Parent Property

Tag Property

Visible Property

X1 Property

X2 Property

Y1 Property

Y2 Property


Line Control Methods

Refresh Method

ZOrder Method


ListBox Control

See Also	Properties	Methods 	Events

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

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.


See Also

AddItem Method

List Property

ListCount Property

ListIndex Property

RemoveItem Method


ListBox Control Properties

Appearance Property

BackColor Property

Columns Property

Container Property

DragIcon Property

DragMode Property

Enabled Property

Font Property

FontBold Property

FontItalic Property

FontName Property

FontSize Property

FontStrikethru Property

FontUnderline Property

ForeColor Property

Height Property

HelpContextID Property

hWnd Property

Index Property

ItemData Property

Left Property

List Property

ListCount Property

ListIndex Property

MouseIcon Property

MousePointer Property

MultiSelect Property

Name Property

NewIndex Property

Parent Property

SelCount Property

Selected Property

Sorted Property

TabIndex Property

TabStop Property

Tag Property

Text Property

Top Property

TopIndex Property

VisibleProperty

Width Property


ListBox Control Methods

AddItem Method

Clear Method

Drag Method

Move Method

Refresh Method

RemoveItem Method

SetFocus Method

ZOrder Method


ListBox Control Events

Click Event

DblClick Event

DragDrop Event

DragOver Event

GotFocus Event

KeyDown Event

KeyPress Event

KeyUp Event

LostFocus Event

MouseDown Event

MouseMove Event

MouseUp Event


MDIForm Object

See Also	Properties	Methods 	Events

An MDI (multiple-document interface) form is a window that acts as the background of an application and is the container for forms that have their MDIChild property set to True.

Note	 For Visual Basic in-process OLE server (DLL) considerations and restrictions that apply to this topic, see Make OLE DLL File Command.

Syntax

MDIForm

Remarks

You create an MDIForm object by choosing MDI Form from the Insert menu.

An application can have only one MDIForm object but many MDI child forms.  If an MDI child form has menus, the child form's menu bar automatically replaces the MDIForm object's menu bar when the MDI child form is active.  A minimized MDI child form is displayed as an icon within the MDIForm.

An MDIForm object can contain only Menu and PictureBox controls and custom controls that have an Align property.  To place other controls on an MDIForm, you can draw a picture box on the form, and then draw other controls inside the picture box.  You can use the Print method to display text in a picture box on an MDIForm, but you can't use this method to display text on the MDIForm itself.

An MDIForm object can't be modal.

MDI child forms are designed independently of the MDIForm, but are always contained within the MDIForm at run time.

You can access the collection of controls on an MDIForm using the Controls collection.  For example, to hide all the controls on an MDIForm you can use code similar to the following:

For Each Control in MDIForm1.Controls

Control.Visible = False

Next Control

The Count property of the MDIForm tells you the number of controls in the Controls collection.


See Also

MDIChild Property

Print Method


MDIForm Object Properties

ActiveControl Property

ActiveForm Property

Appearance Property

AutoShowChildren

BackColor Property

Caption Property

Enabled Property

Height Property

HelpContextID Property

hWnd Property

Icon Property

Left Property

LinkMode Property

LinkTopic Property

MouseIcon Property

MousePointer Property

Name Property

Picture Property

ScaleHeight Property

ScaleWidth Property

ScrollBars Property

Tag Property

Top Property

Visible Property

Width Property

WindowState Property


MDIForm Object Methods

Arrange Method

Hide Method

Move Method

PopupMenu Method

SetFocus Method

Show Method

ZOrder Method


MDIForm Object Events

Activate Event

Click Event

DblClick Event

Deactivate Event

DragDrop Event

DragOver Event

LinkClose Event

LinkError Event

LinkExecute Event

LinkOpen Event

Load Event

MouseMove Event

QueryUnload Event

Resize Event

Unload Event


Menu Control

See Also	Properties	Events

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

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.

When you create an MDI application, the menu bar on the MDI child form replaces the menu bar on the MDIForm object when the child form is active.


See Also

MDIForm Object


Menu Control Properties

Appearance Property

Caption Property

Checked Property

Enabled Property

HelpContextID Property

Index Property

Name Property

Parent Property

ShortCut Property

Tag Property

Visible Property

WindowList Property


Menu Control Events

Click Event


OptionButton Control

See Also	Properties	Methods 	Events

An OptionButton control displays an option that can be turned on or off.

Syntax

OptionButton

Remarks

Usually, OptionButton controls are used in an option group to display options from which the user selects only one.  You group OptionButton controls by drawing them inside a container such as a Frame control, a PictureBox control, or a form.  To group OptionButton controls in a Frame or PictureBox, draw the Frame or PictureBox 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.


See Also

CheckBox Control

Form Object

Frame Object

PictureBox Control


OptionButton Control Properties

Alignment Property

Appearance Property

BackColor Property

Caption Property

Container Property

DragIcon Property

DragMode Property

Enabled Property

Font Property

FontBold Property

FontItalic Property

FontName Property

FontSize Property

FontStrikethru Property

FontUnderline Property

ForeColor Property

Height Property

HelpContextID Property

hWnd Property

Index Property

Left Property

MouseIcon Property

MousePointer Property

Name Property

Parent Property

TabIndex Property

TabStop Property

Tag Property

Top Property

Value Property

Visible Property

Width Property


OptionButton Control Methods

Drag Method

Move Method

Refresh Method

SetFocus Method

ZOrder Method


OptionButton Control Events

Click Event

DblClick Event

DragDrop Event

DragOver Event

GotFocus Event

KeyDown Event

KeyPress Event

KeyUp Event

LostFocus Event

MouseDown Event

MouseMove Event

MouseUp Event


PictureBox Control

See Also	Properties	Methods 	Events

A PictureBox control can display a graphic from a bitmap, icon, or metafile.  It clips the graphic if the control isn't large enough to display the entire image.

Syntax

PictureBox

Remarks

You can also use a PictureBox control to group OptionButton controls and to display output from graphics methods and text written with the Print method.

To make a PictureBox control automatically resize to display an entire graphic, set its AutoSize property to True.

To create animation or simulation, you can manipulate graphics properties and methods in code.  Graphics properties and events are useful for run-time print operations, such as modifying the format of a screen form for printing.

A PictureBox control can also act as a destination link in a DDE conversation.

PictureBox is the only standard Visual Basic control that you can place in the internal area of an MDI form.  You can use it to group controls at the top or bottom of the internal area to create a toolbar or status bar.


See Also

AutoSize Property

MDIForm Object

Print Method


PictureBox Control Properties

Align Property

Appearance Property

AutoRedraw Property

AutoSize Property

BackColor Property

BorderStyle Property

ClipControls Property

Container Property

CurrentX Property

CurrentY Property

DragIcon Property

DragMode Property

DrawMode Property

DrawStyle Property

DrawWidth Property

Enabled Property

FillColor Property

FillStyle Property

Font Property

FontBold Property

FontItalic Property

FontName Property

FontSize Property

FontStrikethru Property

FontTransparent Property

FontUnderline Property

ForeColor Property

hDC Property

Height Property

HelpContextID Property

hWnd Property

Image Property

Index Property

Left Property

LinkItem Property

LinkMode Property

LinkTimeout Property

LinkTopic Property

MouseIcon Property

MousePointer Property

Name Property

Parent Property

Picture Property

ScaleHeight Property

ScaleLeft Property

ScaleMode Property

ScaleTop Property

ScaleWidth Property

TabIndex Property

TabStop Property

Tag Property

Top Property

Visible Property

Width Property


PictureBox Control Methods

Circle Method

Cls Method

Drag Method

Line Method

LinkExecute Method

LinkPoke Method

LinkRequest Method

LinkSend Method

Move Method

PaintPicture Method

Point Method

Print Method

PSet Method

Refresh Method

Scale Method

ScaleX Method

ScaleY Method

SetFocus Method

TextHeight Method

TextWidth Method

ZOrder Method


PictureBox Control Events

Change Event

Click Event

DblClick Event

DragDrop Event

DragOver Event

GotFocus Event

KeyDown Event

KeyPress Event

KeyUp Event

LinkClose Event

LinkError Event

LinkNotify Event

LinkOpen Event

LostFocus Event

MouseDown Event

MouseMove Event

MouseUp Event

Paint Event

Resize Event


Shape Control

See Also	Properties	Methods

The Shape control is a graphical control displayed as a rectangle, square, oval, circle, rounded rectangle, or rounded square.

Syntax

Shape

Remarks

Use Shape controls at design time instead of, or in addition to, invoking Circle and Line methods at run time.  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 isn't 1 and BorderStyle isn't 0 or 6, BorderStyle is set to 1.


See Also

Circle Method

Frame Control

Line Method

PictureBox Control


Shape Control Properties

Appearance Property

BackColor Property

BackStyle Property

BorderColor Property

BorderStyle Property

BorderWidth Property

Container Property

DrawMode Property

FillColor Property

FillStyle Property

Height Property

Index Property

Left Property

Name Property

Parent Property

Shape Property

Tag Property

Top Property

Visible Property

Width Property


Shape Control Methods

Move Method

Refresh Method

ZOrder Method


TextBox Control

See Also	Properties	Methods 	Events

A TextBox control, sometimes called an edit field or edit control, displays information entered at design time, entered by the user, or assigned to the control in code at run time.

Syntax

TextBox

Remarks

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.

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.

A TextBox control can also act as a destination link in a DDE conversation.


See Also

Alignment Property

MultiLine Property

ScrollBars Property


TextBox Control Properties

Alignment Property

Appearance Property

BackColor Property

BorderStyle Property

Container Property

DragIcon Property

DragMode Property

Enabled Property

Font Property

FontBold Property

FontItalic Property

FontName Property

FontSize Property

FontStrikethru Property

FontUnderline Property

ForeColor Property

Height Property

HelpContextID Property

HideSelection Property

hWnd Property

Index Property

Left Property

LinkItem Property

LinkMode Property

LinkTimeout Property

LinkTopic Property

Locked Property

MaxLength Property

MouseIcon Property

MousePointer Property

MultiLine Property

Name Property

Parent Property

PasswordChar Property

ReadOnly Property

ScrollBars Property

SelLength Property

SelStart Property

SelText Property

TabIndex Property

TabStop Property

Tag Property

Text Property

Top Property

Visible Property

Width Property


TextBox Control Methods

Drag Method

LinkExecute Method

LinkPoke Method

LinkRequest Method

Move Method

Refresh Method

SetFocus Method

ZOrder Method


TextBox Control Events

Change Event

Click Event

DblClick Event

DragDrop Event

DragOver Event

GotFocus Event

KeyDown Event

KeyPress Event

KeyUp Event

LinkClose Event

LinkError Event

LinkNotify Event

LinkOpen Event

LostFocus Event

MouseDown Event

MouseMove Event

MouseUp Event


Timer Control

See Also	Properties	Events

A Timer control can execute code at regular intervals by causing a Timer event.

Syntax

Timer

Remarks

The Timer control, invisible to the user, is useful for background processing.

You can't set the Enabled property of a Timer for a multiple selection of controls other than Timer controls.


See Also

Enabled Property

Timer Event


Timer Control Properties

Enabled Property

Index Property

Interval Property

Left Property

Name Property

Parent Property

Tag Property

Top Property


Timer Control Events

Timer Event


Action Property (CommonDialog)

See Also	Applies To

Returns or sets the type of dialog box to be displayed.  Not available at design time.

Note   The Action property is included for compatibility with earlier versions of Visual Basic.  For additional functionality, use the following new methods: ShowColor, ShowFont, ShowHelp, ShowOpen, ShowPrinter, and ShowSave.

Syntax

object.Action [= value]

The Action property syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

value	A numeric expression specifying the type of dialog box displayed, as described in Settings.

Settings

The settings for value are:

Setting	Description

0	No Action.

1	Displays Open dialog box.

2	Displays Save As dialog box.

3	Displays Color dialog box.

4	Displays Font dialog box.

5	Displays Printer dialog box.

6	Runs WINHELP.EXE.


See Also

ShowColor Method

ShowFont Method

ShowHelp Method

ShowOpen Method

ShowPrinter Method

ShowSave Method


Action Property (CommonDialog) Applies To

CommonDialog Control


BackColor, ForeColor Properties

See Also	Applies To

BackColor [image] returns or sets the background color of an object.

ForeColor [image] returns or sets the foreground color used to display text and graphics in an object.

Syntax

object.BackColor [= color]

object.ForeColor [= color]

The BackColor and ForeColor property syntaxes have these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

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 operating environment red-green-blue (RGB) color scheme.  The settings for color are:

Setting	Description

Normal RGB colors	Colors specified by using the Color palette or by using the RGB or QBColor functions 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 [image] set to the system default color specified by the constant vbWindowBackground.

ForeColor [image] 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 or a PictureBox control, all text and graphics, including the persistent graphics, are erased.  Setting the ForeColor property doesn't 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 isn't 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've selected aren't displayed, one of the selected colors may be dithered [image] 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.


See Also

FillColor Property

FillStyle Property


BackColor, ForeColor Properties Apply To

CheckBox Control

ComboBox Control

CommandButton Control (BackColor only)

DirListBox Control

DriveListBox Control

FileListBox Control

Form Object

Frame Control

Grid Control

Label Control

ListBox Control

MDIForm Object (BackColor only)

OptionButton Control

Shape Control (BackColor only)

TextBox Control


BackStyle Property

See Also	Applies To

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 BackStyle property syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

number	A numeric expression specifying transparency, as described in Settings.

Settings

The settings for number are:

Setting	Description

0	Transparent [image] background color and any graphics are visible behind the control.

1	(Default) Opaque [image] 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're using a background color on a Form object or PictureBox control or when you want to place a control over a graphic.  Use an opaque control when you want it to stand out.

A control's BackColor property is ignored if BackStyle = 0.


See Also

BackColor, ForeColor Properties


BackStyle Property Applies To

Label Control

Shape Control


BorderColor Property

See Also	Applies To

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

Syntax

object.BorderColor [= color]

The BorderColor property syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

color	A value or constant that determines the border color, as described in Settings.

Settings

Visual Basic uses the Microsoft Windows operating environment red-green-blue (RGB) color scheme.  The settings for color are:

Setting	Description

Normal RGB colors	Colors specified using the Color palette or by using the RGB or QBColor functions 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 isn't 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.


See Also

BackColor, ForeColor Properties

DrawWidth Property


BorderColor Property Applies To

Line Control

Shape Control


BorderStyle Property

See Also	Applies To

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 BorderStyleColor property syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

value	A value or constant that determines the border style, as described in Settings.

Settings

The BorderStyle property settings for a Form object are:

Setting	Description

0	None (no border or border-related elements).

1	Fixed Single.  Can include Control-menu box, title bar, Maximize button, and Minimize button.  Resizable only using Maximize and Minimize buttons.

2	(Default) Sizable.  Resizable using any of the optional border elements listed for setting 1.

3	Fixed Dialog.  Can include Control-menu box and title bar; can't include Maximize or Minimize buttons.  Not resizable.

4	Fixed ToolWindow.  Under 16-bit versions of Windows and Windows NT 3.51 and earlier, behaves like Fixed Single.  Does not display Maximize or Minimize buttons.  Not resizable.  Under Windows 95, displays the Close button and displays the title bar text in a reduced font size.  The form does not appear in the Windows 95 task bar.

5	Sizable ToolWindow.  Under 16-bit versions of Windows and Windows NT 3.51 and earlier, behaves like Sizable.  Does not display Maximize or Minimize buttons.  Resizable.  Under Windows 95, displays the Close button and displays the title bar text in a reduced font size.  The form does not appear in the Windows 95 task bar.

The BorderStyle property settings for Grid, Image, Label, OLE container, PictureBox, and TextBox controls are:

Setting	Description

0	(Default for Image and Label controls) None.

1	(Default for Grid, PictureBox, TextBox, and OLE container controls) Fixed Single.

The BorderStyle property settings for Line and Shape controls are:

Setting	Description

0	Transparent.

1	(Default) Solid.  The border is centered on the edge of the shape.

2	Dash.

3	Dot.

4	Dash-dot.

5	Dash-dot-dot.

6	Inside solid.  The outer edge of the border is the outer edge of the shape.

Remarks

For a form, the BorderStyle property determines key characteristics that visually identify a form as either a general-purpose window or a dialog box.  Setting 3 (Fixed Dialog) is useful for standard dialog boxes.  Settings 4 (Fixed ToolWindow) and 5 (Sizable ToolWindow) are useful for creating toolbox-style windows.

MDI child forms set to 2 (Sizable) are displayed within the MDI form in a default size defined by the Windows operating environment at run time.  For any other setting, the form is displayed in the size specified at design time.

Changing the setting of the BorderStyle property of a Form object may change the settings of the MinButton, MaxButton, and ShowInToolbar properties.  When BorderStyle is set to 1 (Fixed Single) or 2 (Sizable), the MinButton, MaxButton, and ShowInToolbar properties are automatically set to True.  When BorderStyle is set to 0 (None), 3 (Fixed Dialog), 4 (Fixed ToolWindow), or 5 (Sizable ToolWindow), the MinButton, MaxButton, and ShowInToolbar properties are automatically set to False.

Note   If a form with a menu is set to 3 (Fixed Dialog), it is displayed with a setting 1 (Fixed Single) border instead.

At run time, a form is either modal or modeless, which you specify using the Show method.


 See Also

Caption Property

ControlBox Property

DrawStyle Property

MaxButton Property

MinButton Property


BorderStyle Property Applies To

Form Object

Grid Control

Image Control

Label Control

Line Control

Shape Control

TextBox Control


BorderWidth Property

See Also	Applies To

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

Syntax

object.BorderWidth [= number]

The BorderWidth property syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

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 Line or Shape control.  The following table shows the effect of BorderStyle settings on the BorderWidth property:

BorderStyle	Effect on BorderWidth

0	BorderWidth setting is ignored.

1 [image] 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.

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


 See Also

BorderStyle Property

DrawWidth Property

Height, Width Properties


BorderWidth Property Applies To

Line Control

Shape Control


Cancel Property

See Also	Applies To

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 or any object within an OLE container control that behaves as a command button.

Syntax

object.Cancel [= boolean]

The Cancel property syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

boolean	A Boolean expression specifying whether the object is the Cancel button, as described in Settings.

Settings

The settings for boolean are:

Setting	Description

True	The CommandButton control is the Cancel button.

False	(Default) The CommandButton control isn't 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's 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.

For OLE container controls, the Cancel property is provided only for those objects that specifically behave as command buttons.

Tip   For a form that supports irreversible operations, such as deletions, it's 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.


 See Also

Default Property

KeyDown, KeyUp Events

KeyPress Event


Cancel Property Applies To

CommandButton Control


CancelError Property

Applies To

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

Syntax

object.CancelError [= boolean]

The CancelError property syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

boolean	A Boolean expression indicating whether an error is generated, as described in Settings.

Settings

The settings for boolean are:

Setting	Description

True	An error is generated.

False	(Default) No error is generated.

Remarks

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


CancelError Property Applies To

CommonDialog Control


Col, Row Properties

See Also	Applies To

Return or set the active cell in a Grid control.  Not available at design time.

Syntax

object.Col [= number]

object.Row [= number]

The Col and Row property syntaxes have these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

number	The number of the column or row containing the active cell.

Remarks

Use these properties to specify a cell in a Grid control or to find out which column or row contains the active cell in a selected region.  Columns and rows are numbered from zero, beginning at the top for rows and at the left for columns.  Setting these properties at run time doesn't change which cells are selected.  Use the SelEndCol, SelStartCol, SelEndRow, and SelStartRow properties to specify a selected region.

Note   The Col and Row properties aren't the same as the Cols and Rows properties.


See Also

Clip Property

Cols, Rows Properties

SelEndCol, SelStartCol, SelEndRow, SelStartRow Properties

Text Property


Col, Row Properties Apply To

Grid Control


Cols, Rows Properties

See Also	Applies To

Return or set the total number of columns or rows in a Grid control.

Syntax

object.Cols [= number]

object.Rows [= number]

The Cols and Rows property syntaxes have these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

number	The number of columns or rows in a Grid control.  The minimum number of columns is 1, the maximum is 400; the minimum number of rows is 1, the maximum is 2000.

Remarks

Use these properties to expand a Grid control dynamically at run time.  A Grid control must have at least one non-fixed column and one non-fixed row.

Note   The Cols and Rows properties aren't the same as the Col and Row properties.


See Also

Col, Row Properties


Cols, Rows Properties Apply To

Grid Control


ControlBox Property

See Also	Applies To

Returns or sets a value indicating whether a Control-menu box is displayed on a form at run time.  Read-only at run time.

Syntax

object.ControlBox

The object placeholder represents an object expression that evaluates to an object in the Applies To list.

Settings

The ControlBox property settings are:

Setting	Description

True	(Default) Displays the Control-menu box.

False	Removes the Control-menu box.

Remarks

To display a Control-menu box, you must also set the form's BorderStyle property to 1 (Fixed Single), 2 (Sizable), or 3 (Fixed Dialog).

Both modal and modeless windows can include a Control-menu box.

The commands available at run time depend on the settings for related properties [image] for example, setting MaxButton and MinButton to False disables the Maximize and Minimize commands on the Control menu, but the Move and Close commands remain available.

Note   Settings you specify for the ControlBox, BorderStyle, MaxButton, and MinButton properties aren't reflected in the form's appearance until run time.


 See Also

BorderStyle Property

MaxButton Property

MinButton Property


ControlBox Property Applies To

Form Object


DefaultExt Property

Applies To

Returns or sets the default filename extension for the dialog box.

Syntax

object.DefaultExt [= string]

The DefaultExt property syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

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.


DefaultExt Property Applies To

CommonDialog Control


DialogTitle Property

Applies To

Returns or sets the string displayed in the title bar of the dialog box.

Syntax

object.DialogTitle [= title]

The DialogTitle property syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

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 or Font dialog boxes.

The default title for an Open dialog box is Open; the default title for a Save As dialog box is Save As.


DialogTitle Property Applies To

CommonDialog Control


DrawWidth Property

See Also	Applies To

Returns or sets the line width for output from graphics methods.

Syntax

object.DrawWidth [= size]

The DrawWidth property syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

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 settings 1 through 4 produce a solid line (the DrawStyle property value isn't changed).  Setting DrawWidth to 1 allows DrawStyle to produce the results shown in the DrawStyle property table.


 See Also

Circle Method

DrawMode Property

DrawStyle Property

FillColor Property

FillStyle Property

ForeColor Property


DrawWidth Property Applies To

Form Object


FileTitle Property

Applies To

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 in the Applies To list.

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.

Note   If the cdlOFNNoValidate flag is set, the FileTitle property won't return a value.


FileTitle Property Applies To

CommonDialog Control


Filter Property (CommonDialog)

See Also	Applies To

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 Filter property syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

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.  Don't 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.


Filter Property (CommonDialog) Applies To

CommonDialog Control


See Also

FilterIndex Property


FilterIndex Property

See Also	Applies To

Returns or sets a default filter for an Open or Save As dialog box.

Syntax

object.FilterIndex [= number]

The FilterIndex property syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

number	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.


FilterIndex Property Applies To

CommonDialog Control


See Also

Filter Property


Flags Property (Color Dialog)

See Also	Applies To

Returns or sets the options for a Color dialog box.

Syntax

object.Flags [= value]

The Flags property syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

value	A constant or value specifying the options for a Color dialog box, as described in Settings.

Settings

The settings for value are:

Constant	Value	Description

cdCClFullOpen	&H2&	Causes the entire dialog box, including the portion that enables the user to create custom colors, to be displayed when the dialog box is created.  Without this flag, the user must choose the Define Custom Colors command button to display this portion of the dialog box.

cdlCCPreventFullOpen	&H4&	Disables the Define Custom Colors command button and prevents the user from defining custom colors.

cdlCCRGBInit	&H1&	Sets the initial color value for the dialog box.

cdlCCShowHelp	&H8&	Causes the dialog box to display a Help button.

Remarks

These constants are listed in the Microsoft CommonDialog Control (MSComDlg) object library in the Object browser.

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:

CMDialog1.Flags = &H10& Or &H200&

Adding the desired constant values produces the same results.  The following is equivalent to the preceding example:

CMDialog1.Flags = &H210&


See Also

Or Operator


Flags Property (Color Dialog) Applies To

CommonDialog Control


Flags Property (File Dialog)

See Also	 	Applies To

Returns or sets the options for the Open and Save As dialog boxes.

Syntax

object.Flags [= value]

The Flags property syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

value	A constant or value specifying the options for the Open and Save As dialog boxes, as described in Settings.

Settings

The settings for value are:

Constant	Value	Description
cdlOFNAllowMultiselect	&H200&	Specifies that the File Name list box allows multiple selections. The user can select more than one file at run time by pressing the SHIFT key and using the UP ARROW and DOWN ARROW keys to select the desired files.  When this is done, the FileName property returns a string containing the names of all selected files.  The names in the string are delimited by spaces.
cdlOFNCreatePrompt	&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.
cdlOFNExtensionDifferent	&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.
cdlOFNFileMustExist	&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.
cdlOFNHideReadOnly	&H4&	Hides the Read Only check box.
cdlOFNNoChangeDir	&H8&	Forces the dialog box to set the current directory to what it was when the dialog box was opened.
cdlOFNNoReadOnlyReturn	&H8000&	Specifies that the returned file won't have the Read Only attribute set and won't be in a write-protected directory.
cdlOFNNoValidate	&H100&	Specifies that the common dialog box allows invalid characters in the returned filename.
cdlOFNOverwritePrompt	&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.
cdlOFNPathMustExist	&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.
cdlOFNReadOnly	&H1&	Causes the Read Only check box to be initially checked when the dialog box is created.  This flag also indicates the state of the Read Only check box when the dialog box is closed.
cdlOFNShareAware	&H4000&	Specifies that sharing violation errors will be ignored.
cdlOFNHelpButton	&H10&	Causes the dialog box to display the Help button.
cdlOFNExplorer	&H8000&	Specifies using the Windows 95 explorer-like Open A File dialog box templete.  (Windows 95 only.)
cdlOFNNoDereferenceLinks	&H100000&	Do not dereference shortcuts (shell links).  By default, choosing a shortcut causes it to be dereferenced by the shell.  (Windows 95 only.)
cdOFNLongNames	&H200000&	Allows the user to use long filenames. Windows 95 only.)
Remarks

These constants are listed in the Microsoft CommonDialog Control (MSComDlg) object library in the Object browser.

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.  For example:

Const ReadOnly  = &H00000001&
Const Effects    = &H00000100&
CMDialog1.Flags = &H10& Or &H200&

Adding the desired constant values produces the same results.  The following is equivalent to the preceding example:

CMDialog1.Flags = &H210&


See Also

DefaultExt Property

FileName Property


Flags Property (File Dialog) Applies To

CommonDialog Control


Flags Property (Font Dialog)

Applies To

Returns or sets the options for the Font dialog box.

Syntax

object.Flags [= value]

The Flags property syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

value	A constant or value specifying the options for a Font dialog box, as described in Settings.

Settings

The settings for value are:

Constant	Value	Description
cdlCFANSIOnly	&H400&	Specifies that the dialog box allows only a selection of the fonts that use the Windows character set.  If this flag is set, the user won't be able to select a font that contains only symbols.
cdlCFBoth	&H3&	Causes the dialog box to list the available printer and screen fonts.  The hDC property identifies the device context associated with the printer.
cdlCFEffects	&H100&	Specifies that the dialog box enables strikethrough, underline, and color effects.
cdlCFFixedPitchOnly	&H4000&	Specifies that the dialog box selects only fixed-pitch fonts.
cdlCFForceFontExist	&H10000&	Specifies that an error message box is displayed if the user attempts to select a font or style that doesn't exist.
cdlCFLimitSize	&H2000&	Specifies that the dialog box selects only font sizes within the range specified by the Min and Max properties.
cdlCFNoSimulations	&H1000&	Specifies that the dialog box doesn't allow graphic device interface (GDI) font simulations.
cdlCFNoVectorFonts	&H800&	Specifies that the dialog box doesn't allow vector-font selections.
cdlCFPrinterFonts	&H2&	Causes the dialog box to list only the fonts supported by the printer, specified by the hDC property.
cdlCFScalableOnly	&H20000&	Specifies that the dialog box allows only the selection of fonts that can be scaled.
cdlCFScreenFonts	&H1&	Causes the dialog box to list only the screen fonts supported by the system.
cdlCFHelpButton	&H4&	Causes the dialog box to display a Help button.
cdlCFTTOnly	&H40000&	Specifies that the dialog box allows only the selection of TrueType fonts.
cdlCFWYSIWYG	&H8000&	Specifies that the dialog box allows only the selection of fonts that are available on both the printer and on screen.  If this flag is set, the cdlCFBoth and cdlCFScalableOnly flags should also be set.
Remarks

These constants are listed in the Microsoft CommonDialog Control (MSComDlg) object library in the Object browser.

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.  For example:

Const ReadOnly  = &H00000001&

Const Effects    = &H00000100&

You can set more than one flag for a dialog box using the Or operator.  For example:

CMDialog1.Flags = &H10& Or &H200&

Adding the desired constant values produces the same results.  The following is equivalent to the preceding example:

CMDialog1.Flags = &H210&

Note   You must set the Flags property to cdlCFScreenFonts, cdlCFPrinterFonts, or cdlCFBoth before displaying the Fonts dialog box.  Otherwise, the error No Fonts Exist occurs.


See Also

hDC Property

Max, Min Properties (CommonDialog)

Or Operator


Flags Property (Font Dialog) Applies To

CommonDialog Control


Flags Property (Print Dialog)

See Also	Applies To

Returns or sets the options for the Print dialog box.

Syntax

object.Flags [= value]

The Flags property syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

value	A constant or value specifying the options for the Print dialog box, as described in Settings.

Settings

The settings for value are:

Constant	Value	Description
cdlPDAllPages	&H0&	Returns or sets the state of the All Pages option button.
cdlPDCollate	&H10&	Returns or sets the state of the Collate check box.
cdlPDDisablePrintToFile	&H80000&	Disables the Print To File check box.
cdlPDHidePrintToFile	&H100000&	Hides the Print To File check box.
cdlPDNoPageNums	&H8&	Disables the Pages option button and the associated edit control.
cdlPDNoSelection	&H4&	Disables the Selection option button.
cdlPDNoWarning	&H80&	Prevents a warning message from being displayed when there is no default printer.
cdlPDPageNums	&H2&	Returns or sets the state of the Pages option button.
cdlPDPrintSetup	&H40&	Causes the system to display the Print Setup dialog box rather than the Print dialog box.
cdlPDPrintToFile	&H20&	Returns or sets the state of the Print To File check box.
cdlPDReturnDC	&H100&	Returns a device context for the printer selection made in the dialog box.  The device context is returned in the dialog box's hDC property.
cdlPDReturnIC	&H200&	Returns an information context for the printer selection made in the dialog box.  An information context provides a fast way to get information about the device without creating a device context.  The information context is returned in the dialog box's hDC property.
cdlPDReturnDefault	&H400&	Returns default printer name.
cdlPDSelection	&H1&	Returns or sets the state of the Selection option button.  If neither cdlPDPageNums nor cdlPDSelection is specified, the All option button is in the selected state.
cdlPDHelpButton	&H800&	Causes the dialog box to display the Help button.
cdlPDUseDevModeCopies	&H40000&	If a printer driver doesn't support multiple copies, setting this flag disables the copies edit control.  If a driver does support multiple copies, setting this flag indicates that the dialog box stores the requested number of copies in the Copies property.
Remarks

These constants are listed in the Microsoft CommonDialog Control (MSComDlg) object library in the Object browser.

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.  For example:

Const ReadOnly  = &H00000001&

Const Effects    = &H00000100&

You can set more than one flag for a dialog box using the Or operator.  For example:

CMDialog1.Flags = &H10& Or &H200&

Adding the desired constant values produces the same results.  The following is equivalent to the preceding example:

CMDialog1.Flags = &H210&


Flags Property (Print Dialog) Applies To

CommonDialog Control


See Also

Copies Property

hDC Property

Or Operator


FontBold, FontItalic, FontStrikethru, FontUnderline Properties

See Also	Applies To

Return or set font styles in the following formats: Bold, Italic, Strikethru, and Underline.

Note   The FontBold, FontItalic, FontStrikethru, and FontUnderline properties are included for use with the CommonDialog control and for compatibility with earlier versions of Visual Basic.  For additional functionality, use the new Font object properties (not available for the CommonDialog control).

Syntax

object.FontBold [= boolean]

object.FontItalic [= boolean]

object.FontStrikethru [= boolean]

object.FontUnderline [= boolean]

The FontBold, FontItalic, FontStrikethru, and FontUnderline property syntaxes have these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

boolean	A Boolean expression specifying the font style as described in Settings.

Settings

The settings for boolean are:

Setting	Description

True	(Default for FontBold, except with the CommonDialog control) Turns on the formatting in that style.

False	(Default for FontItalic, FontStrikethru, and FontUnderline, and FontBold with the CommonDialog control) Turns off the formatting in that style.

Remarks

Use these font properties to format text, either at design time using the Properties window or at run time using code.  For PictureBox controls and Form and Printer objects, setting these properties doesn't 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 operating environment uses a different font for TrueType fonts that are smaller than 8 points.


 See Also

FontName Property

FontSize Property

TextHeight Method

TextWidth Method


FontBold, FontItalic, FontStrikethru, FontUnderline Properties Applies To
FontBold, FontItalic, FontStrikethru, FontUnderline Properties Apply To

CheckBox Control

ComboBox Control

CommandButton Control

CommonDialog Control

DirListBox Control

DriveListBox Control

FileListBox Control

Form Object

Frame Control

Grid Control

Label Control

ListBox Control

OptionButton Control

TextBox Control


FontName Property

See Also	Applies To

Returns or sets the font used to display text in a control or in a run-time drawing or printing operation.

Note   The FontName property is included for use with the CommonDialog control and for compatibility with earlier versions of Visual Basic.  For additional functionality, use the new Font object properties (not available for the CommonDialog control).

Syntax

object.FontName [= font]

The FontName property syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

font	A string expression specifying the font name to use.

Remarks

The default for this property is determined by the system.  Fonts available with Visual Basic 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 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.


See Also

FontBold, FontItalic, FontStrikethru, FontUnderline Properties

FontCount Property

FontSize Property

Print Method

TextHeight Method

TextWidth Method


FontName Property Applies To

CheckBox Control

ComboBox Control

CommandButton Control

CommonDialog Control

DirListBox Control

DriveListBox Control

FileListBox Control

Form Object

Frame Control

Grid Control

Label Control

ListBox Control

OptionButton Control

TextBox Control


FontSize Property

See Also	Applies To

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.

Note   The FontSize property is included for use with the CommonDialog control and for compatibility with earlier versions of Visual Basic.  For additional functionality, use the new Font object properties (not available for the CommonDialog control).

Syntax

object.FontSize [= points]

The FontSize property syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

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 Visual Basic 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.  The Microsoft Windows operating environment uses a different font for TrueType fonts that are smaller than 8 points.


See Also

FontBold, FontItalic, FontStrikethru, FontUnderline Properties

FontCount Property

FontName Property


FontSize Property Applies To

CheckBox Control

ComboBox Control

CommandButton Control

CommonDialog Control

DirListBox Control

DriveListBox Control

FileListBox Control

Form Object

Frame Control

Grid Control

Label Control

ListBox Control

OptionButton Control

TextBox Control


FromPage, ToPage Properties

Applies To

Return or set the values for the From and To text boxes.

Syntax

object.FromPage [= number]

object.ToPage [= number]

The FromPage and ToPage property syntaxes have these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

number	A numeric expression that specifies the first and last pages to be printed.

Remarks

These properties are valid only when the cdlPDPageNums flag has been set.


FromPage, ToPage Properties Apply To

CommonDialog Control (Print Dialog)


Height, Width Properties

See Also	Applies To

Return or set the dimensions of an object or the width of the Columns object of a DBGrid control.  For the Printer and Screen objects, not available at design time.

Syntax

object.Height [= number]

object.Width [= number]

The Height and Width property syntaxes have these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

number	A numeric expression specifying the dimensions of an object, as described in Settings.

Settings

Measurements are calculated as follows:

Form [image] the external height and width of the form, including the borders and title bar.

Control [image] 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.

Printer object [image] the physical dimensions of the paper set up for the printing device; not available at design time.  If set at run time, values in these properties are used instead of the setting of the PaperSize property.

Screen object [image] the height and width of the screen; not available at design time and read-only at run time.

Picture object [image] the height and width of the picture in HiMetric units.

Remarks

For Form, Printer, 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.

If you set the Height and Width properties for a printer driver that doesn't allow these properties to be set, no error occurs and the size of the paper remains as it was.  If you set Height and Width for a printer driver that allows only certain values to be specified, no error occurs and the property is set to whatever the driver allows.  For example, you could set Height to 150 and the driver would set it to 144.

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.

Note   The Height property can't 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 Columns object of the DBGrid control, Width is specified in the unit of measure of the object that contains the DBGrid.  The default value for Width is the value of the DefColWidth property of DBGrid.

For the Picture object, use the ScaleX and ScaleY methods to convert HiMetric units into the scale you need.


See Also

Left, Top Properties

Move Method

PaperSize Property

ScaleHeight, ScaleWidth Properties

ScaleLeft, ScaleTop Properties

ScaleX, ScaleY Methods

Width # Statement


Height, Width Properties Apply To

CheckBox Control

ComboBox Control

CommandButton Control

DirListBox Control

DriveListBox Control

FileListBox Control

Form Object

Frame Control

Grid Control

HScrollBar, VScrollBar Controls

Image Control

Label Control

ListBox Control

MDIForm Object

OptionButton Control

Shape Control

TextBox Control


HelpCommand Property

See Also	Applies To

Returns or sets the type of online Help requested.

Syntax

object.HelpCommand [= value]

The HelpCommand property syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

value	A constant or value specifying the type of Help, as described in Settings.

Settings

The settings for value are:

Constant	Value	Description
cdlHelpCommand	&H102	Executes a Help macro.
cdlHelpContents	&H3	Displays the Help contents topic as defined by the Contents option in the [OPTION] section of the .HPJ file.
cdlHelpContext	&H1	Displays Help for a particular context.  When using this setting, you must also specify a context using the HelpContext property.
cdlHelpContextPopup	&H8	Displays in a pop-up window a particular Help topic identified by a context number defined in the [MAP] section of the .HPJ file.
cdlHelpForceFile	&H9	Ensures that WinHelp displays the correct Help file.  If the correct Help file is currently displayed, no action occurs.  If the incorrect Help file is displayed, WinHelp opens the correct file.
cdlHelpHelpOnHelp	&H4	Displays Help for using the Help application itself.
cdlHelpIndex	&H3	Displays the index of the specified Help file.  An application should use this value only for a Help file with a single index.
cdlHelpKey	&H101	Displays Help for a particular keyword.  When using this setting, you must also specify a keyword using the HelpKey property.
cdlHelpPartialKey	&H105	Displays the topic found in the keyword list that matches the keyword passed in the dwData parameter if there is one exact match.  If more than one match exists, the Search dialog box with the topics found listed in the Go To list box is displayed.  If no match exists, the Search dialog box is displayed.  To bring up the Search dialog box without passing a keyword, use a long pointer to an empty string.
cdlHelpQuit	&H2	Notifies the Help application that the specified Help file is no longer in use.
cdlHelpSetContents	&H5	Determines which contents topic is displayed when a user presses the F1 key.
cdlHelpSetIndex	&H5	Sets the context specified by the HelpContext property as the current index for the Help file specified by the HelpFile property.  This index remains current until the user accesses a different Help file.  Use this value only for Help files with more than one index.
Remarks

The values for the HelpCommand property constants are listed in the Microsoft CommonDialog Control (MSComDlg) object library in the Object browser.


HelpCommand Property Applies To

CommonDialog Control


See Also

HelpContext Property

HelpKey Property


HelpContext Property (CommonDialog)

See Also 	Applies To

Returns or sets the context ID of the requested Help topic.

Syntax

object.HelpContext [= value]

The HelpContext property syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

value	A string expression specifying the context ID of the requested Help topic.

Remarks

Use this property with the HelpCommand property (set HelpCommand = cdlHelpContext) to specify the Help topic to be displayed.


HelpContext Property Applies To

CommonDialog Control


See Also

HelpCommand Property


HelpKey Property

See Also	Applies To

Returns or sets the keyword that identifies the requested Help topic.

Syntax

object.HelpKey [= string]

The HelpKey property syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

string	A string expression specifying the keyword that identifies the Help topic.

Remarks

Use this property with the HelpCommand property (set HelpCommand = cdlHelpKey) to specify the Help topic to be displayed.


HelpKey Property Applies To

CommonDialog Control


See Also

HelpCommand Property


Icon Property

Applies To

Returns the icon displayed when a form is minimized at run time.

Syntax

object.Icon

The object placeholder represents an object expression that evaluates to an object in the Applies To list.

Remarks

Use this property to specify an icon for any form that the user can minimize at run time.

For example, you can assign an unique icon to a form to indicate the form's function.  Specify the icon by loading it using the Properties window at design time.  The file you load must have the .ICO filename extension and format.  If you don't specify an icon, the Visual Basic default icon for forms is used.

You can use the Visual Basic Icon Library (in the ICONS subdirectory) as a source for icons.  When you create an executable file, you can assign an icon to the application by using the Icon property of any form in that application.

Note   To see a form's icon, the form must be minimized.  The BorderStyle property must be set to either 1 (Fixed Single) or 2 (Sizable).  The MinButton property must be set to True.

At run time, you can assign an object's Icon property to another object's DragIcon or Icon property.  You can also assign an icon returned by the LoadPicture function.  Using LoadPicture without an argument assigns an empty (null) icon to the form, which enables you to draw on the icon at run time.


Icon Property Applies To

Form Object

MDIForm Object


InitDir Property

Applies To

Returns or sets the initial file directory.

Syntax

object.InitDir [= string]

The InitDir property syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

string	A string expression specifying the initial file directory.

Remarks

If this property isn't specified, the current directory is used.


InitDir Property Applies To

CommonDialog Control (File Dialog)


Interval Property

See Also	Applies To

Returns or sets the number of milliseconds between calls to a Timer control's Timer event.

Syntax

object.Interval [= milliseconds]

The Interval property syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

milliseconds	A numeric expression specifying the number of milliseconds, as described in Settings.

Settings

The settings for milliseconds are:

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.

Note   There are a limited number of timers available (16 in the Windows environment).  Trying to start a timer if none is available causes a run-time error.


See Also

Enabled Property


Interval Property Applies To

Timer Control


Left, Top Properties

See Also	Applies To

Left [image] returns or sets the distance between the internal left edge of an object and the left edge of its container.

Top [image] 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 Left and Top property syntaxes have these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

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 a Timer control, these properties aren't available at run time.

For both properties, 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 Form and Printer objects.


 See Also

Left Function

Move Method

ScaleHeight, ScaleWidth Properties

ScaleLeft, ScaleTop Properties

ScaleMode Property


Left, Top Properties Apply To

CheckBox Control

ComboBox Control

CommandButton Control

CommonDialog Control

DirListBox Control

DriveListBox Control

FileListBox Control

Form Object

Frame Control

Grid Control

HScrollBar, VScrollBar Controls

Image Control

Label Control

ListBox Control

MDIForm Object

OptionButton Control

Shape Control

TextBox Control

Timer Control


List Property

See Also	Applies To

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-only at run time for DirListBox, DriveListBox, and FileListBox controls; read/write at run time for ComboBox and ListBox controls.

Syntax

object.List(index) [= string]

The List property syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

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 except the DirListBox, the index of the first item is 0 and the index of the last item is ListCount [image] 1.

For a DirListBox control, the index number sequence is based on the current directories and subdirectories when the control is created at run time.  The directory that is currently expanded is represented using the index [image] 1.  Directories above the currently expanded directory are represented by negative indexes with higher absolute values.  For example, [image] 2 is the parent directory of the directory that is currently expanded and [image] 3 is the directory above that.  Directories below the directory that is currently expanded range from 0 to ListCount [image] 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:

DirListBox [image] contains a list of all directories, using the range -n to ListCount [image] 1.

DriveListBox [image] contains the list of drive connections in effect.

FileListBox [image] contains the list of files in the directory that is currently expanded that match the Pattern property.  The path isn't included.

The List property works in conjunction with the ListCount and ListIndex properties.

For all applicable controls except a DirListBox, enumerating a list from 0 to ListCount -1 returns all items in the list.  For a DirListBox control, enumerating the list from [image] n to ListCount [image] 1 returns a list containing all directories and subdirectories visible from the directory that is currently expanded.  In this case n is the number of directory levels above the directory that is currently expanded.

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.

Using an Option Base = 1 statement in the Declarations section doesn't affect the enumeration of elements in Visual Basic controls.  The first element is always 0.

When the List index is outside the range of actual entries in the list box, a zero-length string ("") is returned.  For example, List(-1) returns a zero-length string for a ComboBox or ListBox control.


See Also

AddItem Method

ListCount Property

ListIndex Property

Pattern Property

RemoveItem Method

Sorted Property


List Property Applies To

ComboBox Control

DirListBox Control

DriveListBox Control

FileListBox Control

ListBox Control


ListCount Property

See Also	Applies To

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 in the Applies To list.

Remarks

ListCount provides specific information for each control:

ComboBox and ListBox controls [image] the number of items in the list.

DirListBox control [image] the number of subdirectories in the current directory.

DriveListBox control [image] the number of drive connections.

FileListBox control [image] the number of files in the current directory that match the Pattern property setting.

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


 See Also

AddItem Method

List Property

ListIndex Property

Pattern Property

RemoveItem Method


ListCount Property Applies To

ComboBox Control

DirListBox Control

DriveListBox Control

FileListBox Control

ListBox Control


ListIndex Property

See Also	Applies To

Returns or sets the index of the currently selected item in the control.  Not available at design time.

Syntax

object.ListIndex [= index]

The ListIndex property syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

index	A numeric expression specifying the index of the current item, as described in Settings.

Settings

The settings for index are:

Setting	Description

1	(Default for ComboBox, DirListBox, and DriveListBox controls) Indicates no item is currently selected.  For a ComboBox control, indicates the user has entered new text into the text box portion.  For a DirListBox control, indicates the index of the current path.  For a DriveListBox control, indicates the index of the current drive when the control is created at run time.

n	(Default for FileListBox and 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.


See Also

AddItem Method

Drive Property

List Property

ListCount Property

Path Property

RemoveItem Method


ListIndex Property Applies To

ComboBox Control

DirListBox Control

DriveListBox Control

FileListBox Control

ListBox Control


Max, Min Properties (CommonDialog)

Applies To

You can set the Max and Min properties for the following:

Font dialog box [image] return or set the smallest and largest font sizes displayed in the Size list box.

Print dialog box [image] return or set the minimum and maximum allowed values for the print range.

Syntax

object.Min [= points]

object.Max [= points]

object.Min [= number ]

object.Max [= number ]

The Max and Min property syntaxes have these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

points	A numeric expression specifying the smallest and largest font sizes.

number	A numeric expression specifying the minimum and maximum page numbers.

Remarks

With the Font dialog box, the LimitSize flag must be set before using these properties.

With the Print dialog box, the Min property determines the smallest number the user can specify in the From text box.  The Max property determines the largest number the user can specify in the To text box.


Max, Min Properties Apply To

CommonDialog Control


MaxButton Property

See Also	Applies To

Returns a value indicating whether a form has a Maximize button.

Syntax

object.MaxButton

The object placeholder represents an object expression that evaluates to an object in the Applies To list.

Settings

The MaxButton property settings are:

Setting	Description

True	(Default) The form has a Maximize button.

False	The form doesn't have a Maximize button.

Remarks

A Maximize button enables users to enlarge a form window to full-screen size.  To display a Maximize button, you must also set the form's BorderStyle property to either 1 (Fixed Single) or 2 (Sizable).

A Maximize button automatically becomes a Restore button when a window is maximized.  Minimizing or restoring a window automatically changes the Restore button back to a Maximize button.

The settings you specify for the MaxButton, MinButton, BorderStyle, and ControlBox properties aren't reflected in the form's appearance until run time.

Note   Maximizing a form at run time generates a Resize event.  The WindowState property reflects the current state of the window.  If you set the WindowState property to 2 (Maximized), the form is maximized independently of whatever settings are in effect for the MaxButton and BorderStyle properties.


See Also

ControlBox Property

MinButton Property


MaxButton Property Applies To

Form Object


MinButton Property

See Also	Applies To

Returns a value indicating whether a form has a Minimize button.

Syntax

object.MinButton

The object placeholder represents an object expression that evaluates to an object in the Applies To list.

Return Values

The MinButton return values are:

Setting	Description

True	(Default) The form has a Minimize button.

False	The form doesn't have a Minimize button.

Remarks

A Minimize button enables users to minimize a form window to an icon.  To display a Minimize button, you must also set the form's BorderStyle property to either 1 (Fixed Single) or 2 (Sizable).

The settings you specify for the MaxButton, MinButton, BorderStyle, and ControlBox properties aren't reflected in the form's appearance until run time.

Note   Minimizing a form to an icon at run time generates a Resize event.  The WindowState property reflects the current state of the window.  If you set the WindowState property to 2 (Maximized), the form is maximized independently of whatever settings are in effect for the MaxButton and BorderStyle properties.


See Also

ControlBox Property

MaxButton Property


MinButton Property Applies To

Form Object


Picture Property

See Also	Applies To

Returns or sets a graphic to be displayed in a control.  For the OLE container control, not available at design time and read-only at run time.

Syntax

object.Picture [= picture]

The Picture property syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

picture	A string expression specifying a file containing a graphic, as described in Settings.

Settings

The settings for picture are:

Setting	Description

(None)	(Default) No picture.

(Bitmap, icon, metafile)	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 LoadPicture function on a bitmap, icon, or metafile.

Remarks

At design time, you can transfer a graphic with the Clipboard using the Copy, Cut, and Paste commands on the Edit menu.  At run time, you can use Clipboard methods such as GetData, SetData, and GetFormat with the nontext Clipboard constants vbCFBitmap, vbCFMetafile, and vbCFDIB, which are listed in the Visual Basic (VB) object library in the Object browser.

When setting the Picture property at design time, the graphic is saved and loaded with the form.  If you create an executable file, the file contains the image.  When you load a graphic at run time, the graphic isn't saved with the application.  Use the SavePicture statement to save a graphic from a form or picture box into a file.

Note   At run time, the Picture property can be set to any other object's DragIcon, Icon, Image, or Picture property, or you can assign it the graphic returned by the LoadPicture function.


See Also

AutoRedraw Property

Icon Property


Picture Property Applies To

Form Object

Image Control

MDIForm Object


PrinterDefault Property

Applies To

Returns or sets an option that determines if the user's selections in the Print dialog box are used to change the system's default printer settings.

Syntax

object.PrinterDefault [= value]

The PrinterDefault property syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

value	A Boolean expression specifying whether the user's selections are used to change the system's default printer settings, as described in Settings.

Settings

The settings for value are:

Setting	Description

True	Any selections the user makes in the Setup portion of the Print dialog box (printer selection, orientation, and so on) are used to change the printer settings in the user's WIN.INI file.  (On the Windows NT operating system, this information is stored in the Registry.)

False	User's selections can't be used to change the system's default printer settings.

Remarks

When PrinterDefault is True, you can write code to print directly to the Visual Basic Printer object.  Otherwise, you must use the graphic device interface (GDI) calls to print to the printer specified by the control's hDC property.

Note   If you've previously printed to the Printer object, make sure you've ended that print job using Printer.EndDoc.  This releases the hDC associated with that printer.  You will get a new hDC for the default printer the next time you print to the Printer object.  If you don't do this, it's possible for the user to select a new printer while the Printer object contains a handle to the old printer.


PrinterDefault Property Applies To

CommonDialog Control


Sorted Property

See Also	Applies To

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 in the Applies To list.

Return Values

The Sorted property return values are:

Setting	Description

True	List items are sorted alphabetically (case-insensitive).

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.


See Also

AddItem Method

List Property

ListCount Property

ListIndex Property

RemoveItem Method


Sorted Property Applies To

ComboBox Control

ListBox Control


TabIndex Property

See Also	Applies To

Returns or sets the tab order of an object within its parent form.

Syntax

object.TabIndex [= index]

The TabIndex property syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

index	An integer from 0 to (n [image] 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.  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.  You can make changes at design time using the Properties window or at run time in code.

All controls except menus and timers are included in the tab order.  At run time, invisible or disabled controls and controls that can't receive the focus (Frame and Label controls) remain in the tab order but are skipped during tabbing.

The TabIndex property isn't affected by the ZOrder method.

Note   A control's tab order doesn't 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 aren't 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.


See Also

TabStop Property

ZOrder Method


TabIndex Property Applies To

CheckBox Control

ComboBox Control

CommandButton Control

DirListBox Control

DriveListBox Control

FileListBox Control

Frame Control

Grid Control

HScrollBar, VScrollBar Controls

Label Control

ListBox Control

OptionButton Control

TextBox Control


Tag Property

See Also	Applies To

Returns or sets an expression that stores any extra data needed for your program.  Unlike other properties, the value of the Tag property isn't used by Visual Basic; you can use this property to identify objects.

Syntax

object.Tag [= expression]

The Tag property syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

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 or MDIForm object 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.


See Also

Name Property


Tag Property Applies To

CheckBox Control

ComboBox Control

CommandButton Control

CommonDialog Control

DirListBox Control

DriveListBox Control

FileListBox Control

Form Object

Frame Control

Grid Control

HScrollBar, VScrollBar Controls

Image Control

Label Control

Line Control

ListBox Control

MDIForm Object

Menu Object

OptionButton Control

Shape Control

TextBox Control

Timer Control


Text Property

See Also	Applies To

ComboBox control (Style property set to 0 [Dropdown Combo] or to 1 [Simple Combo]) and TextBox control [image] returns or sets the text contained in the edit area.

ComboBox control (Style property set to 2 [Dropdown List]) and ListBox control [image] 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.

Grid control [image] returns or sets the text contained in a cell or range of cells.  Not available at design time.

Syntax

object.Text [= string]

The Text property syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

string	A string expression specifying text.

Remarks

At design time only, the defaults for the Text property are:

ComboBox and TextBox controls [image] the control's Name property.

ListBox control [image] 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.

For a Grid control, you can add text to a single cell by setting the Text property.  This property applies to the cell defined by the current values of the Grid control's Row and Col properties.

You can use the Text and FillStyle properties to add the same text to a highlighted range of cells.  When FillStyle = 0, the text assigned to the Text property is added only to the cell defined by the current Row and Col property values.  When FillStyle = 1, the text is added to all cells whose CellSelected property setting is True.

You can also use the Clip property to fill a range of cells.  For example, you might want to paste a large block of information from the Clipboard into a Grid control.


See Also

SelLength, SelStart, SelText Properties

Value Property


Text Property Applies To

ComboBox Control

Grid Control

ListBox Control

TextBox Control


Value Property

See Also	Applies To

CheckBox and OptionButton controls [image] returns or sets the state of the control.

CommandButton control [image] returns or sets a value indicating whether the button is chosen; not available at design time.

Field object [image] returns or sets the content of a field; not available at design time.

HScrollBar and VScrollBar controls (horizontal and vertical scroll bars) [image] 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 Value property syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

value	Value specifying the state, content, or position of a control, as described in Settings.

Settings

The settings for value are:

CheckBox control [image] 0 is Unchecked (default), 1 is Checked, and 2 is Grayed (dimmed).

CommandButton control [image] True indicates the button is chosen; False (default) indicates the button isn't chosen.  Setting the Value property to True in code invokes the button's Click event.

Field object [image] restricted only by the Field data types.

HScrollBar and VScrollBar controls [image] set values between [image] 32,768 and 32,767 to position the scroll box.

OptionButton control [image] True indicates the button is selected; False (default) indicates the button isn't selected.

Remarks

A default property of an object is assumed, and doesn't need to be specified in code.  For example, Field is the default property of any Recordset, and Value is the default property of a Field object.  This makes the two statements below equivalent:

Dn.Fields("PubID").Value = X

Dn.("PubID") = X

The first statement specifies the default properties; the second statement assumes them.


See Also

Max, Min Properties (Scroll Bar)


Value Property Applies To

CheckBox Control

CommandButton Control

HScrollBar, VScrollBar Controls

OptionButton Control


Visible Property

See Also	Applies To

Returns or sets a value indicating whether an object is visible or hidden.

Syntax

object.Visible [= boolean]

The Visible property syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

boolean	A Boolean expression specifying whether the object is visible or hidden.

Settings

The settings for boolean are:

Setting	Description

True	(Default) Object is visible.

False	Object is hidden.

Note   For Visual Basic in-process OLE server (DLL) considerations and restrictions that apply to this topic, see Make OLE DLL File Command.

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.


See Also

Hide Method

Show Method


Visible Property Applies To

CheckBox Control

ComboBox Control

CommandButton Control

DirListBox Control

DriveListBox Control

FileListBox Control

Form Object

Frame Control

Grid Control

HScrollBar, VScrollBar Controls

Image Control

Label Control

Line Control

ListBox Control

MDIForm Object

Menu Object

OptionButton Control

Shape Control

TextBox Control


Align Property

See Also	Applies To

Returns or sets a value that determines whether an object is displayed in any size anywhere on a form or whether it's displayed at the top, bottom, left, or right of the form and is automatically sized to fit the form's width.

Syntax

object.Align [= number]

The Align property syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

number	An integer that specifies how an object is displayed, as described in Settings.

Settings

The settings for number are:

Setting	Description

0	(Default in a non-MDI form) None [image] size and location can be set at design time or in code.  This setting is ignored if the object is on an MDI form.

1	(Default in an MDI form) Top [image] object is at the top of the form, and its width is equal to the form's ScaleWidth property setting.

2	Bottom [image] object is at the bottom of the form, and its width is equal to the form's ScaleWidth property setting.

3	Left [image] object is at the left of the form, and its width is equal to the form's ScaleWidth property setting.

4	Right [image] object is at the right of the form, and its width is equal to the form's ScaleWidth property setting.

Remarks

You can use the Align property to quickly create a toolbar or status bar at the top or bottom of a form.  As a user changes the size of the form, an object with Align set to 1 or 2 automatically resizes to fit the width of the form.

PictureBox and Data controls are the only standard controls that can be placed on an MDI form.  The internal area of an MDI form is defined by the space not covered by controls.  When an MDI child form is maximized within the parent MDI form, it won't cover any controls.

Use number settings 3 and 4 to align toolbars at the left and right sides of a form or MDI form.  If there are two toolbars in a corner of an MDI form, the top- or bottom-aligned one extends to the corner, taking precedence over the left- or right-aligned one.  Left- and right-aligned objects occupy the internal area on an MDI form, just like top- and bottom-aligned objects.


See Also

Alignment Property

ScaleHeight, ScaleWidth Properties


Align Property Applies To

PictureBox Control


Alignment Property

See Also	Applies To

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

Syntax

object.Alignment [= number]

The Alignment property syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

number	An integer that specifies the type of alignment, as described in Settings.

Settings

For CheckBox and OptionButton controls, the settings for number are:

Setting	Description

0	(Default) Control is left-aligned; control is right-aligned.

1	Control is right-aligned; control is left-aligned.

For Label and TextBox controls, the settings for number are:

Setting	Description

0	(Default) Text is left-aligned.

1	Text is right-aligned.

2	Text is centered.

For a DBGrid column, the settings for number are:

Setting	Description

0	Text is left-aligned.

1	Text is right-aligned.

2	Text is centered.

3	(Default) General [image] Text is left-aligned; numbers are right-aligned.

Remarks

You can display text to the right or left of OptionButton and CheckBox controls.  Text is always left-aligned.

If the MultiLine property setting of a TextBox control is False, the Alignment property is ignored.


 See Also

Align Property


Alignment Property Applies To

CheckBox Control

Label Control

OptionButton Control

TextBox Control


Archive, Hidden, Normal, System Properties

See Also	Applies To

Return or set a value that determines whether a FileListBox control displays files with Archive, Hidden, Normal, or System attributes.

Syntax

object.Archive [= boolean]
object.Hidden [= boolean]
object.Normal [= boolean]
object.System [= boolean]

The Archive, Hidden, Normal, and System property syntaxes have these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

boolean	A Boolean expression that specifies the type of files displayed, as described in Settings.

Settings

The settings for boolean are:

Setting	Description

True	(Default for Archive and Normal) Displays files with the property's attribute in the FileListBox control.

False	(Default for Hidden and System) Displays files without the property's attribute in the FileListBox control.

Remarks

Use these properties to specify the type of files to display in a FileListBox control, based on standard file attributes used in the operating environment.  Setting any of these properties with code at run time resets the FileListBox control to display only those files with the specified attributes.

For example, in a find-and-replace operation you could display only system files by setting the System property to True and the other properties to False.  Or, as part of a file backup procedure, you could set the Archive property to True to list only those files modified since the previous backup.


See Also

Path Property

Pattern Property


Archive, Hidden, Normal, System Properties Applies To
Archive, Hidden, Normal, System Properties Apply To

FileListBox Control


AutoRedraw Property

See Also	Applies To

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

Syntax

object.AutoRedraw [= boolean]

The AutoRedraw property syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

boolean	A Boolean expression that specifies how the object is repainted, as described in Settings.

Settings

The settings for boolean are:

Setting	Description

True	Enables automatic repainting of a Form object or PictureBox control.  Graphics and text are written to the screen and to an image stored in memory.  The object doesn't receive Paint events; it's 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: Circle, Cls, Line, Point, Print, and PSet.  Setting AutoRedraw to True automatically redraws the output from these methods in a Form object or PictureBox control 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 aren't 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.

To retrieve the persistent graphic created when AutoRedraw is set to True, use the Image property.  To pass the persistent graphic to a Windows API when AutoRedraw is set to True, use the object's hDC property.

If you set a form's AutoRedraw property to False and then minimize the form, the ScaleHeight and ScaleWidth properties are set to icon size.  When AutoRedraw is set to True, ScaleHeight and ScaleWidth remain the size of the restored window.


 See Also

Circle Method

Cls Method

hDC Property

Image Property

Line Method

Paint Event

Point Method

Print Method

PSet Method

ScaleHeight, ScaleWidth Properties


AutoRedraw Property Applies To

Form Object

PictureBox Control


AutoShowChildren Property

See Also	Applies To

Returns or sets a value that determines whether MDI child forms are displayed when loaded.

Syntax

object.AutoShowChildren [= boolean]

The AutoShowChildren property syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

boolean	A Boolean expression that specifies whether MDI child forms are automatically visible, as described in Settings.

Settings

The settings for boolean are:

Setting	Description

True	(Default) MDI child forms are automatically displayed when loaded.

False	MDI child forms aren't automatically displayed when loaded.

Remarks

You can use the AutoShowChildren property to load MDI child forms and leave them hidden until they're displayed using the Show method.


See Also

ActiveForm Property

MDIChild Property


AutoShowChildren Property Applies To

MDIForm Object


AutoSize Property

See Also	Applies To

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

Syntax

object.AutoSize [= boolean]

The AutoSize property syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

boolean	A Boolean expression that specifies whether the control is resized, as described in Settings.

Settings

The settings for boolean are:

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.


See Also

Alignment Property

Resize Event


AutoSize Property Applies To

Label Control

PictureBox Control


CellSelected Property

See Also	Applies To

Returns a value that determines whether the cell specified by the Col and Row properties (the active cell) is within the Grid control's selected region.

Syntax

object.CellSelected

The object placeholder represents an object expression that evaluates to an object in the Applies To list.

Settings

The settings for CellSelected property are:

Setting	Description

True	The specified cell is within the selected area.

False	The specified cell isn't within the selected area.

Remarks

You can use this property to determine whether the user has selected a specific cell or a specific range of cells.

At run time, the user can select a range of cells by clicking a cell and then dragging the mouse or by pressing SHIFT and using the arrow keys.

Use the SelEndCol, SelStartCol, SelEndRow, and SelStartRow properties to determine the selected region.  Use the Col and Row properties to determine the active cell.


See Also

Col, Row Properties

RowColChange Event

SelChange Event

SelEndCol, SelStartCol, SelEndRow, SelStartRow Properties


CellSelected Property Applies To

Grid Control


Clip Property

See Also	Applies To

Returns or sets the contents of the cells in a selected region of a Grid control.  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 in the Applies To list.

string	A string expression containing the cell contents.

Remarks

The string can contain the contents of multiple rows and columns.  In string, a tab character (ANSI character 9) indicates a new cell in a row, and a carriage return (ANSI character 13) indicates the beginning of a new row.  Use the Chr function to embed these characters in strings.  For example, the following line of code puts text into a selected area two rows high and two columns wide:

Grid1.Clip = "1st" & Chr(9) & "a" & Chr(13) & "2nd" & Chr(9) & "b"

When you put 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 set to Null.  If there are more cells described in string than in the selected region, the unused portion of string is ignored.


See Also

Chr Function

SelEndCol, SelStartCol, SelEndRow, SelStartRow Properties

Text Property


Clip Property Applies To

Grid Control


ClipControls Property

See Also	Applies To

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 operating environment creates a clipping region that excludes nongraphical controls contained by the object.  Read-only at run time.

Syntax

object.ClipControls

The ClipControls property syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

boolean	A Boolean expression that specifies how objects are repainted, as described in Settings.

Settings

The settings for boolean are:

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 isn't 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 or PictureBox 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 doesn't clip around the Image, Label, Line, 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 picture box).  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.


 See Also

AutoRedraw Property

Circle Method

Line Method

Paint Event

Print Method


ClipControls Property Applies To

Form Object

Frame Control

PictureBox Control


ColAlignment Property

See Also	Applies To

Returns or sets the alignment of data in a column.  Not available at design time.

Syntax

object.ColAlignment(column) [= number]

The ColAlignment property syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

column	The number of a column.

number	An integer that specifies the column alignment, as described in Settings.

Settings

The settings for number are:

Setting	Description

0	(Default) Left-aligned.

1	Right-aligned.

2	Centered.

Remarks

Any column can have an alignment that is different from other columns.  This property doesn't affect cells in a fixed column.  To set the alignment for a fixed column, use the FixedAlignment property.


See Also

Alignment Property

FixedAlignment Property


ColAlignment Property Applies To

Grid Control


Color Property

See Also	Applies To

Returns or sets the selected color.

Syntax

object.Color [= number]

The Color property syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

number	A numeric expression that specifies the color.

Settings

The settings for number are:

Setting	Description

Normal RGB colors	Colors set with the RGB or QBColor functions 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 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 RGBInit flag must be set.  In the Font dialog box, the Effects flag must be set.


See Also

Flags Property (Color Dialog)

RGB Function


Color Property Applies To

CommonDialog Control (Color Dialog)


ColorMode Property

Returns or sets a value that determines whether a color printer prints output in color or monochrome.  Not available at design time.

Syntax

object.ColorMode [= value]

The ColorMode property syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

value	A constant or integer that specifies the print mode, as described in Settings.

Settings

The settings for value are:

Setting	Value	Description

vbPRCMMonochrome	1	Print output in monochrome (usually shades of black and white).

vbPRCMColor	2	Print output in color.

Remarks

The default value depends on the printer driver and the current printer settings.  Monochrome printers ignore this property.

Note   The effect of the properties of the Printer object depends on the driver supplied by the printer manufacturer.  Some property settings may have no effect, or several different property settings may all have the same effect.  Settings outside the accepted range may produce an error.  For more information, see the manufacturer's documentation for the specific driver.


Columns Property (ListBox)

See Also	Applies To

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 Columns property syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

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:

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't be set to 0 or changed from 0 at run time [image] that is, you can't 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.


 See Also

AddItem Method

List Property

ListCount Property

ListIndex Property

RemoveItem Method

TopIndex Property


Columns Property Applies To

ListBox Control


ColWidth Property

See Also	Applies To

Returns or sets the width of the specified column in twips.  Not available at design time.

Syntax

object.ColWidth(column) [= number]

The ColWidth property syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

column	The number of a column.

number	A numeric expression that specifies the column width.

Remarks

You can use this property to set the width of any column at run time.  Users can also change the width of a column by positioning the mouse pointer between columns and then dragging.


See Also

RowHeight Property


ColWidth Property Applies To

Grid Control


Copies Property

See Also	Applies To

Returns or sets a value that determines the number of copies to be printed.  For the Printer object, not available at design time.

Syntax

object.Copies [= number]

The Copies property syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

number	A numeric expression that specifies the number of copies to print.  This value must be an integer.

Remarks

For the Print dialog box, this property returns the number of copies entered by the user in the Copies box.  If the UseDevModeCopies flag is set for the CommonDialog control, this property always returns 1.

For the Printer object, multiple copies may or may not be collated, depending on the printer driver.  Multiple copies of the entire document or multiple copies of each page may be printed.  For printers that don't support collating, set Copies = 1, and then use a loop in code to print multiple copies of the entire document.

Note   The effect of the properties of the Printer object depends on the driver supplied by the printer manufacturer.  Some property settings may have no effect, or several different property settings may all have the same effect.  Settings outside the accepted range may produce an error.  For more information, see the manufacturer's documentation for the specific driver.


See Also

Duplex Property

PaperBin Property


Copies Property Applies To

CommonDialog Control


CurrentX, CurrentY Properties

See Also	Applies To

Return or set the horizontal (CurrentX) or vertical (CurrentY) coordinates for the next printing or drawing method.  Not available at design time.

Syntax

object.CurrentX [= x]
object.CurrentY [= y]

The CurrentX and CurrentY properties syntax have these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

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

Circle	The center of the object.

Cls	0, 0.

EndDoc	0, 0.

Line	The end point of the line.

NewPage	0, 0.

Print	The next print position.

PSet	The point drawn.


 See Also

Circle Method

Cls Method

DrawMode Property

DrawStyle Property

EndDoc Method

Left, Top Properties

Line Method

NewPage Method

Print Method

PSet Method

ScaleHeight, ScaleWidth Properties

ScaleLeft, ScaleTop Properties


CurrentX, CurrentY Properties Applies To
CurrentX, CurrentY Properties Apply To

Form Object

PictureBox Control


Default Property

See Also	Applies To

Returns or sets a value that determines which CommandButton control is the default command button on a form.

Syntax

object.Default [= boolean]

The Default property syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

boolean	A Boolean expression that specifies whether the command button is the default, as described in Settings.

Settings

The settings for boolean are:

Setting	Description

True 	The CommandButton is the default command button.

False 	(Default) The CommandButton isn't 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's 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 doesn't 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.

For OLE container controls, the Default property is provided only for those objects that specifically behave like CommandButton controls.


See Also

Cancel Property


Default Property Applies To

CommandButton Control


DeviceName Property

See Also

Returns the name of the device a driver supports.

Syntax

object.DeviceName

The object placeholder represents an object expression that evaluates to an object in the Applies To list.

Remarks

Each printer driver supports one or more devices [image] for example, HP LaserJet IIISi is a device name.

Note   The effect of properties of the Printer object depends on the driver supplied by the printer manufacturer.  Some property settings may have no effect, or several different property settings may all have the same effect.  Settings outside the accepted range may produce an error.  For more information, see the manufacturer's documentation for the specific driver.


See Also

hDC Property


DragIcon Property

See Also	Applies To

Returns or sets the icon to be displayed as the pointer in a drag-and-drop operation.

Syntax

object.DragIcon [= icon]

The DragIcon property syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

icon	Any code reference that returns a valid icon, such as a reference to a form's icon (Form1.Icon), a reference to another control's DragIcon property (Text1.DragIcon), or the LoadPicture function.

Settings

The settings for icon are:

Setting	Description

(none)	(Default) An arrow pointer inside a rectangle.

Icon	A custom mouse pointer.  You specify the icon by setting it using the Properties window at design time.  You can also use the LoadPicture function at run time.  The file you load must have the .ICO filename extension and format.

Remarks

You can use the DragIcon property to provide visual feedback during a drag-and-drop operation [image] for example, to indicate that the source control is over an appropriate target.  DragIcon takes effect when the user initiates a drag-and-drop operation.  Typically, you set DragIcon as part of a MouseDown or DragOver event procedure.

Note   At run time, the DragIcon property can be set to any object's DragIcon or Icon property, or you can assign it an icon returned by the LoadPicture function.


 See Also

Drag Method

DragDrop Event

DragMode Property

MousePointer Property


DragIcon Property Applies To

CheckBox Control

ComboBox Control

CommandButton Control

DirListBox Control

DriveListBox Control

FileListBox Control

Frame Control

Grid Control

HScrollBar, VScrollBar Controls

Image Control

Label Control

ListBox Control

OptionButton Control

PictureBox Control

TextBox Control


DragMode Property

See Also	Applies To

Returns or sets a value that determines whether manual or automatic drag mode is used for a drag-and-drop operation.

Syntax

object.DragMode [= number]

The DragMode property syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

number	An integer that specifies the drag mode, as described in Settings.

Settings

The settings for number are:

Setting	Description

0	(Default) Manual [image] requires using the Drag method to initiate a drag-and-drop operation on the source control.

1	Automatic [image] clicking the source control automatically initiates a drag-and-drop operation.  OLE container controls are automatically dragged only when they don't have the focus.

Remarks

When DragMode is set to 1 (Automatic), the control doesn't respond as usual to mouse events.  Use the 0 (Manual) setting to determine when a drag-and-drop operation begins or ends; you can use this setting to initiate a drag-and-drop operation in response to a keyboard or menu command or to enable a source control to recognize a MouseDown event prior to a drag-and-drop operation.

Clicking while the mouse pointer is over a target object or form during a drag-and-drop operation generates a DragDrop event for the target object.  This ends the drag-and-drop operation.  A drag-and-drop operation may also generate a DragOver event.

Note   While a control is being dragged, it can't recognize other user-initiated mouse or keyboard events (KeyDown, KeyPress or KeyUp, MouseDown, MouseMove, or MouseUp).  However, the control can receive events initiated by code or by a DDE link.


 See Also

DragDrop Event

DragIcon Property

DragOver Event


DragMode Property Applies To

CheckBox Control

ComboBox Control

CommandButton Control

DirListBox Control

DriveListBox Control

FileListBox Control

Frame Control

Grid Control

HScrollBar, VScrollBar Controls

Image Control

Label Control

ListBox Control

OptionButton Control

PictureBox Control

TextBox Control


DrawMode Property

See Also	Applies To

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 DrawMode property syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

number	An integer that specifies appearance, as described in Settings.

Settings

The settings for number are:

Setting	Description

1	Blackness.

2	Not Merge Pen [image] Inverse of setting 15 (Merge Pen).

3	Mask Not Pen [image] Combination of the colors common to the background color and the inverse of the pen.

4	Not Copy Pen [image] Inverse of setting 13 (Copy Pen).

5	Mask Pen Not [image] Combination of the colors common to both the pen and the inverse of the display.

6	Invert [image] Inverse of the display color.

7	Xor Pen [image] Combination of the colors in the pen and in the display color, but not in both.

8	Not Mask Pen [image] Inverse of setting 9 (Mask Pen).

9	Mask Pen [image] Combination of the colors common to both the pen and the display.

10	Not Xor Pen [image] Inverse of setting 7 (Xor Pen).

11	Nop [image] No operation [image] output remains unchanged.  In effect, this setting turns drawing off.

12	Merge Not Pen [image] Combination of the display color and the inverse of the pen color.

13	Copy Pen (Default) [image] Color specified by the ForeColor property.

14	Merge Pen Not [image] Combination of the pen color and the inverse of the display color.

15	Merge Pen [image] Combination of the pen color and the display color.

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.


See Also

DrawStyle Property

DrawWidth Property

FillColor Property

FillStyle Property

BackColor, ForeColor Properties

Xor Operator


DrawMode Property Applies To

Form Object

Line Control

PictureBox Control

Shape Control


DrawStyle Property

See Also	Applies To

Returns or sets a value that determines the line style for output from graphics methods.

Syntax

object.DrawStyle [= number]

The DrawStyle property syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

number	An integer that specifies line style, as described in Settings.

Settings

The settings for number are:

Setting	Description

0	(Default) Solid.

1	Dash.

2	Dot.

3	Dash-Dot.

4	Dash-Dot-Dot.

5	Transparent.

6	Inside Solid.

Remarks

If DrawWidth is set to a value greater than 1, DrawStyle settings 1 through 4 produce a solid line (the DrawStyle property value isn't changed).  If DrawWidth is set to 1, DrawStyle produces the effect described in the preceding table for each setting.


 See Also

Circle Method

DrawMode Property

DrawWidth Property

FillColor Property

FillStyle Property

BackColor, ForeColor Properties

Line Method

PSet Method


DrawStyle Property Applies To

Form Object

PictureBox Control


Drive Property

See Also	Applies To

Returns or sets the selected drive at run time.  Not available at design time.

Syntax

object.Drive [= drive]

The Drive property syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

drive	A string expression that specifies the selected drive.

Remarks

The valid drives for the Drive property include all drives present in or connected to the system when the control is created or refreshed at run time.  The default setting of the Drive property is the current drive.

When reading this property setting, the selected drive is returned in one of the following formats:

Floppy disks [image] "a:" or "b:", and so on

Fixed media [image] "c: [volume id]"

Network connections [image] "x: \\server\share"

When setting this property:

Only the first character of the string is significant (the string isn't case-sensitive).

Changing the setting for the Drive property invokes a Change event.

Selecting a drive that isn't present causes an error.

Setting this property also regenerates the drive list, providing a way in code to track network connections added since the control was created.

If the FileName property is set to a qualified network path without a drive designation, the value of the Drive property is a zero-length string (""), no drive is selected, and the ListIndex property setting is 1.

Note   The Drive property returns a different value from the ListIndex property, which returns the list box selection.


 See Also

FileName Property

ListIndex Property

Path Property

PathChange Event

Pattern Property

PatternChange Event


Drive Property Applies To

DriveListBox Control


DriverName Property

See Also

Returns the name of the driver for a Printer object.

Syntax

object.DriverName

The object placeholder represents an object expression that evaluates to an object in the Applies To list.

Remarks

Each driver has a unique name.  For example, the DriverName for several of the Hewlett-Packard printers is HPPCL5MS.  The DriverName is typically the driver's filename without an extension.

Note   The effect of the properties of the Printer object depends on the driver supplied by the printer manufacturer.  Some property settings may have no effect, or several different property settings may all have the same effect.  Settings outside the accepted range may produce an error.  For more information, see the manufacturer's documentation for the specific driver.


See Also

DeviceName Property


Duplex Property

Returns or sets a value that determines whether a page is printed on both sides (if the printer supports this feature).  Not available at design time.

Syntax

object.Duplex [= value]

The Duplex property syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

value	A value or constant that specifies the type of printing, as described in Settings.

Settings

The settings for value are:

Constant	Value	Description

vbPRDPSimplex	1	Single-sided printing with the current orientation setting.

vbPRDPHorizontal	2	Double-sided printing using a horizontal page turn.

vbPRDPVertical	3	Double-sided printing using a vertical page turn.

Remarks

With horizontal duplex printing, the top of both sides of the page are at the same end of the sheet.  With vertical duplex printing, the bottom of one page is at the same end of the sheet as the top of the next page.  The following diagram illustrates horizontal and vertical duplex printing:

Note   The effect of the properties of the Printer object depends on the driver supplied by the printer manufacturer.  Some property settings may have no effect, or several different property settings may all have the same effect.  Settings outside the accepted range may produce an error.  For more information, see the manufacturer's documentation for the specific driver.


FileName Property

See Also	Applies To

Returns or sets the path and filename of a selected file.  Not available at design time for the FileListBox control and ProjectTemplate object.

Syntax

object.FileName [=  pathname]

The FileName property syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

pathname	A string expression that specifies the path and filename.

Remarks

When you create the control at run time, the FileName property is set to a zero-length string (""), meaning no file is currently selected.

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.  The path is retrieved separately, using the Path property.  The value is functionally equivalent to List(ListIndex).  If no file is selected, FileName returns a zero-length string.

When setting this property:

Including a drive, path, or pattern in the string changes the settings of the Drive, Path, and Pattern properties accordingly.

Including the name of an existing file (without wildcard characters) in the string selects the file.

Changing the value of this property may also cause one or more of these events: PathChange (if you change the path), PatternChange (if you change the pattern), or DblClick (if you assign an existing filename).

This property setting can be a qualified network path and filename using the following syntax:

\\servername\sharename\pathname


 See Also

Drive Property

List Property

ListIndex Property

Path Property

PathChange Event

Pattern Property

PatternChange Event


FileName Property Applies To

CommonDialog Control

FileListBox Control


FillColor Property

See Also	Applies To

Returns or sets the color used to fill in shapes; FillColor is also used to fill in circles and boxes created with the Circle and Line graphics methods.

Syntax

object.FillColor [ = value]

The FillColor property syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

value	A value or constant that determines the fill color, as described in Settings.

Settings

The settings for value are:

Setting	Description

Normal RGB colors	Colors set with the RGB or QBColor functions 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 operating environment substitutes the user's choices, as specified by the user's Control Panel settings.

By default, FillColor is set to 0 (Black).

Remarks

Except for the Form object, when the FillStyle property is set to its default, 1 (Transparent), the FillColor setting is ignored.


 See Also

BackColor, ForeColor Properties

FillStyle Property

RGB Function


FillColor Property Applies To

Form Object

PictureBox Control

Shape Control


FillStyle Property

See Also	Applies To

Grid control [image] Returns or sets a value that determines whether setting the Text property of a Grid causes the value to be displayed in all selected cells.

All other objects [image] Returns or sets the pattern used to fill Shape controls as well as circles and boxes created with the Circle and Line graphics methods.

Syntax

object.FillStyle [= number]

The FillStyle property syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

number	An integer that specifies the fill style, as described in Settings.

Settings

The number settings for a Grid control are:

Setting	Description

0	Single [image] Changing the Text property affects only the active cell.

1	Repeat [image] Changing the Text property affects all selected cells.

The number settings for other objects are:

Setting	Description

0	Solid.

1	(Default) Transparent.

2	Horizontal Line.

3	Vertical Line.

4	Upward Diagonal.

5	Downward Diagonal.

6	Cross.

7	Diagonal Cross.

Remarks

When FillStyle is set to 1 (Transparent), the FillColor property is ignored, except for the Form object.


 See Also

BorderStyle Property

FillColor Property

Paint Event


FillStyle Property Applies To

Form Object

Grid Control

PictureBox Control

Shape Control


FixedAlignment Property

See Also	Applies To

Returns or sets a value that determines the alignment of data in the fixed cells of a column.  Not available at design time.

Syntax

object.FixedAlignment(column) [= number]

The FixedAlignment property syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

column	The number of a column.

number	An integer that specifies alignment, as described in Settings.

Settings

The settings for number are:

Setting	Description

0	(Default) Left-aligned.

1	Right-aligned.

2	Centered.

3	Use the ColAlignment setting for the column specified by column.

Remarks

The FixedAlignment property behaves like the ColAlignment property except that it only affects the alignment of fixed cells.  You can use FixedAlignment to align headings differently from the rest of the columns.


See Also

ColAlignment Property


FixedAlignment Property Applies To

Grid Control


FixedCols, FixedRows Properties

See Also	Applies To

Return or set the total number of fixed columns or fixed rows for a Grid control.  By default, a Grid has one fixed column and one fixed row.

Syntax

object.FixedCols [= number]
object.FixedRows [= number]

The FixedCols and FixedRows property syntaxes have these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

number	A numeric expression that specifies the number of fixed columns or rows.

Remarks

A fixed column is a stationary column on the left side of the Grid control.  A fixed row is a stationary row along the top of the Grid.  You can have zero or more fixed columns and zero or more fixed rows.  Fixed columns and rows are displayed in gray and don't move when the other columns or rows in the Grid are scrolled.  You can't change the color of a fixed column or row.

Fixed columns and rows are typically used in spreadsheet applications to display row numbers and column names or letters.

A Grid control must have at least one nonfixed column and one nonfixed row.  The maximum number of fixed columns or rows allowed in a Grid is one less than the total number of columns or rows.


See Also

Cols, Rows Properties

FixedAlignment Property


FixedCols, FixedRows Properties Apply To

Grid Control


FontCount Property

See Also

Returns the number of fonts available for the current display device or active printer.

Syntax

object.FontCount

The object placeholder represents an object expression that evaluates to an object in the Applies To list.

Remarks

Use this property with the Fonts property to see a list of available screen or printer fonts.  Fonts available in Visual Basic vary according to your system configuration, display devices, and printing devices.


 See Also

FontName Property

Fonts Property


Fonts Property

See Also

Returns all font names available for the current display device or active printer.

Syntax

object.Fonts(index)

The Fonts property syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

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 or printer fonts.


See Also

FontBold, FontItalic, FontStrikethru, FontUnderline Properties

FontName Property

FontSize Property

TextHeight Method

TextWidth Method


GridLines Property

See Also	Applies To

Returns or sets a value that determines whether the lines between cells are visible.

Syntax

object.Gridlines [ = boolean]

The Highlight property syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

boolean	A value that specifies the visibility of grid lines, as described in Settings.

Settings

The settings for boolean are:

Setting 	Description

True 	(Default) Grid lines are visible.

False	Grid lines aren't visible.


See Also

Cols, Rows Properties

GridLineWidth Property


GridLines Property Applies To

Grid Control


hDC Property

See Also	Applies To

Returns a handle provided by the Microsoft Windows operating environment to the device context of an object.

Syntax

object.hDC

The object placeholder represents an object expression that evaluates to an object in the Applies To list.

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 the Printer object and for each form and PictureBox control in your application.  You can use the hDC property to refer to the handle for an object's device context.  This provides a value to pass to Windows API calls.

With a CommonDialog control, this property returns a device context for the printer selected in the Print dialog box when the cdlReturnDC flag is set or an information context when the cdlReturnIC flag is set.

Note   The value of the hDC property can change while a program is running, so don't store the value in a variable; instead, use the hDC property each time you need it.

The AutoRedraw property can cause the hDC property setting to change.  If AutoRedraw is set to True for a form or PictureBox container, hDC acts as a handle to the device context of the persistent graphic (equivalent to the Image property).  When AutoRedraw is False, hDC is the actual hDC value of the Form window or the PictureBox container.  The hDC property setting may change while the program is running regardless of the AutoRedraw setting.


 See Also

AutoRedraw Property

hWnd Property

Icon Property


hDC Property Applies To

Form Object

PictureBox Control


HideSelection Property

Applies To

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 in the Applies To list.

Return Values

The HideSelection property return values are:

Value	Description

True	(Default) Selected text doesn't 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 [image] for example, in a spell-checking routine.


HideSelection Property Applies To

TextBox Control


HighLight Property

See Also	Applies To

Returns or sets a value that determines whether selected cells appear highlighted.

Syntax

object.Highlight [= boolean]

The Highlight property syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

boolean	A value that specifies selected cells' appearance, as described in Settings.

Settings

The settings for boolean are:

Setting 	Description

True 	(Default) Selected cells are highlighted.

False	Selected cells aren't highlighted.

Remarks

When this property is set to False and the user selects a range of cells, there is no visual cue that shows which cells are selected.


See Also

Col, Row Properties


HighLight Property Applies To

Grid Control


hWnd Property

See Also	Applies To

Returns a handle to a form or control.

Note   This property is no longer supported for the OLE container control.

Syntax

object.hWnd

The object placeholder represents an object expression that evaluates to an object in the Applies To list.

Remarks

The Microsoft Windows operating environment identifies each form and control in an application by assigning it a handle, or hWnd.  The hWnd property is used with Windows API calls.  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.


 See Also

hDC Property

Icon Property


hWnd Property Applies To

CheckBox Control

ComboBox Control

CommandButton Control

DirListBox Control

DriveListBox Control

FileListBox Control

Form Object

Frame Control

Grid Control

HScrollBar, VScrollBar Controls

ListBox Control

MDIForm Object

OptionButton Control

PictureBox Control

TextBox Control


Image Property

See Also	Applies To

Returns a handle to a persistent graphic; the handle is provided by the Microsoft Windows operating environment.

Syntax

object.Image

The object placeholder represents an object expression that evaluates to an object in the Applies To list.

Remarks

An object's AutoRedraw property determines whether the repainting of an object occurs with a persistent graphics or through Paint events.  The Windows operating environment identifies an object's persistent graphic by assigning a handle to it; you can use the Image property to get this handle.

An Image value exists regardless of the setting for the AutoRedraw property.  If AutoRedraw is True and nothing has been drawn, the image displays only the color set by the BackColor property and the picture.

You can assign the value of Image to the Picture property.  The Image property also provides a value to pass to Windows API calls.

The Image, DragIcon, and Picture properties must be used directly when assigning values to other properties, when saving with the SavePicture statement, or when placing something on the Clipboard.  You can't assign these to temporary variables, and then use the results.

The AutoRedraw property can cause Image, which is a handle to a bitmap, to change.  When AutoRedraw is True, an object's hDC property becomes a handle to a device context that contains the bitmap returned by Image.


See Also

AutoRedraw Property

BackColor Property

DragIcon Property

Paint Event

Picture Property


Image Property Applies To

Form Object

PictureBox Control


ItemData Property

See Also	Applies To

Returns or sets a specific number for each item in a ComboBox or ListBox control.

Syntax

object.ItemData(index) [= number]

The ItemData property syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

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 isn't 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.


 See Also

AddItem Method

List Property

ListIndex Property

NewIndex Property

RemoveItem Method

Selected Property

TopIndex Property


ItemData Property Applies To

ComboBox Control

ListBox Control


KeyPreview Property

See Also	Applies To

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 KeyPreview property syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

boolean	A Boolean expression that specifies how events are received, as described in Settings.

Settings

The settings for boolean are:

Setting	Description

True	The form receives keyboard events first and then the active control.

False	(Default) The active control receives keyboard events; the form doesn't.

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 can't receive them.  Examples include the ENTER key when focus is on a CommandButton control and arrow keys when focus is on a ListBox control.


 See Also

KeyDown, KeyUp Events

KeyPress Event


KeyPreview Property Applies To

Form Object


LargeChange, SmallChange Properties

See Also	Applies To

LargeChange [image] 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.

SmallChange [image] 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 LargeChange and SmallChange property syntaxes have these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

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 operating environment automatically sets proportional scrolling increments for scroll bars on Form objects, 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.


 See Also

Change Event

Max, Min Properties

Value Property


LargeChange, SmallChange Properties Applies To
LargeChange, SmallChange Properties Apply To

HScrollBar, VScrollBar Controls


LeftCol Property

See Also	Applies To

Returns or sets the leftmost visible column (other than a fixed column) in a grid.  Not available at design time.

Syntax

object.LeftCol [= number]

The LeftCol property syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

number	A numeric expression that specifies the number of the leftmost visible column.  Default is 0.

Remarks

You can use the LeftCol property in code to scroll a Grid or DBGrid control programmatically.  Use the TopRow property to determine the topmost visible row in the Grid or DBGrid.


See Also

Col, Row Properties

TopRow Property


LeftCol Property Applies To

Grid Control


LinkItem Property

See Also	Applies To

Returns or sets the data passed to a destination control in a DDE conversation with another application.

Syntax

object.LinkItem [= string]

The LinkItem property syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

string	A string expression that specifies the data to be passed to the destination control.

Remarks

This property corresponds to the item argument in the standard DDE syntax, with application, topic, and item as arguments.  To set this property, specify a recognizable unit of data in an application as a reference [image] for example, a cell reference such as "R1C1" in Microsoft Excel.

Use LinkItem in combination with the LinkTopic property to specify the complete data link for a destination control to a source application.  To activate this link, set the LinkMode property.

You set LinkItem only for a control used as a destination.  When a Visual Basic form is a source in a DDE conversation, the name of any Label, PictureBox, or TextBox control on the form can be the item argument in the application|topic!item string used by the destination.  For example, the following syntax represents a valid reference from Microsoft Excel to a Visual Basic application:

=VizBasicApplication|MyForm!TextBox1

You could enter the preceding syntax for a destination cell in the Microsoft Excel formula bar.

A DDE control can potentially act as destination and source simultaneously, causing an infinite loop if a destination-source pair is also a source-destination pair with itself.  For instance, a TextBox control may be both a source (through its parent form) and destination of the same cell in Microsoft Excel.  When data in a Visual Basic TextBox changes, sending data to Microsoft Excel, the cell in Microsoft Excel changes, sending the change to the TextBox, and so on, causing the loop.

To avoid such loops, use related but not identical items for destination-source and source-destination links in both directions between applications.  For example, in Microsoft Excel, use related cells (precedents or dependents) to link a worksheet with a Visual Basic control, avoiding use of a single item as both destination and source.  Document any application|topic pairs you establish if you include a Paste Link command for run-time use.

Note   Setting a permanent data link at design time with the Paste Link command from the Edit menu also sets the LinkMode, LinkTopic, and LinkItem properties.  This creates a link that is saved with the form.  Each time the form is loaded, Visual Basic attempts to re-establish the conversation.


 See Also

LinkMode Property

LinkTopic Property


LinkItem Property Applies To

Label Control

PictureBox Control

TextBox Control


LinkMode Property

See Also	Applies To

Returns or sets the type of link used for a DDE conversation and activates the connection as follows:

Control [image] Allows a destination control on a Visual Basic form to initiate a conversation, as specified by the control's LinkTopic and LinkItem properties.

Form [image] Allows a destination application to initiate a conversation with a Visual Basic source form, as specified by the destination application's application|topic!item expression.

Syntax

object.LinkMode [= number]

The LinkMode property syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

number	An integer that specifies the type of connection, as described in Settings.

Settings

For controls used as destinations in DDE conversations, the settings for number are:

Setting	Description

0	(Default) None [image] No DDE interaction.

1	Automatic [image] Destination control is updated each time the linked data changes.

2	Manual [image] Destination control is updated only when the LinkRequest method is invoked.

3	Notify [image] A LinkNotify event occurs whenever the linked data changes, but the destination control is updated only when the LinkRequest method is invoked.

For forms used as sources in DDE conversations, the settings for number are:

Setting	Description

0	(Default) None [image] No DDE interaction.  No destination application can initiate a conversation with the source form as the topic, and no application can poke data to the form.  If LinkMode is 0 (None) at design time, you can't change it to 1 (Source) at run time.

1	Source [image] Allows any Label, PictureBox, or TextBox control on a form to supply data to any destination application that establishes a DDE conversation with the form.  If such a link exists, Visual Basic automatically notifies the destination whenever the contents of a control are changed.  In addition, a destination application can poke data to any Label, PictureBox, or TextBox control on the form.  If LinkMode is 1 (Source) at design time, you can change it to 0 (None) and back at run time.

Remarks

The following conditions also apply to the LinkMode property:

Setting LinkMode to a nonzero value for a destination control causes Visual Basic to attempt to initiate the conversation specified in the LinkTopic and LinkItem properties.  The source updates the destination control according to the type of link specified (automatic, manual, or notify).

If a Label, PictureBox, or TextBox control has established an automatic link with a source application, a Change event occurs for that control each time new data is entered, whether or not the value of the data differs from the control's current contents.  This is the only way a Change event can occur for a Label control.

If a source application terminates a conversation with a Visual Basic destination control, the value for that control's LinkMode setting changes to 0 (None).

If you leave LinkMode for a form set to the default 0 (None) at design time, you can't change LinkMode at run time.  If you want a form to act as a source, you must set LinkMode to 1 (Source) at design time.  You can then change the value of LinkMode at run time.

Note   Setting a permanent data link at design time with the Paste Link command from the Edit menu also sets the LinkMode, LinkTopic, and LinkItem properties.  This creates a link that is saved with the form.  Each time the form is loaded, Visual Basic attempts to re-establish the conversation.


 See Also

LinkClose Event

LinkError Event

LinkExecute Event

LinkExecute Method

LinkItem Property

LinkNotify Event

LinkOpen Event

LinkRequest Method

LinkSend Method

LinkTimeout Property

LinkTopic Property


LinkMode Property Applies To

Form Object

Label Control

MDIForm Object

PictureBox Control

TextBox Control


LinkTimeout Property

See Also	Applies To

Returns or sets the amount of time a control waits for a response to a DDE message.

Syntax

object.LinkTimeout [= number]

The LinkTimeout property syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

number	A numeric expression that specifies the wait time.

Remarks

By default, the LinkTimeout property is set to 50 (equivalent to 5 seconds).  You can specify other settings in tenths of a second.

DDE response time from source applications varies.  Use this property to adjust the time a destination control waits for a response from a source application.  If you use LinkTimeout, you can avoid generating a Visual Basic error if a given source application takes too long to respond.

Note   The maximum length of time that a control can wait is 65,535 tenths of a second, or about 1 hour 49 minutes.  Setting LinkTimeout to 1 tells the control to wait the maximum length of time for a response in a DDE conversation.  The user can force the control to stop waiting by pressing the ESC key.


 See Also

LinkClose Event

LinkItem Property

LinkMode Property

LinkOpen Event

LinkSend Method

LinkTopic Property


LinkTimeout Property Applies To

Label Control

PictureBox Control

TextBox Control


Locked Property

See Also	Applies To

Returns or sets a value indicating whether a control can be edited.

Syntax

object.Locked [ = boolean]

The Locked property syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

boolean	A Boolean expression that specifies whether the control can be edited, as described in Settings.

Settings

The settings for boolean are:

Setting	Description

True	TextBox control [image] you can scroll and highlight the text in the control, but you can't edit it.  The program can still modify the text by changing the Text property.

Column object [image] you can't edit the values in the column.

False	TextBox control [image] you can edit the text in the control.

Column object [image] you can edit the values in the column.

Remarks

For the Column object, the default setting of Locked is the value of the DataUpdatable property for the underlying field; however, if Column is unbound or the data source doesn't support DataUpdatable, the default is True.  If DataUpdatable in the underlying field is False, you do not create an error by setting this property to True.  However, an error will occur when the control attempts to write the changed data to the database.


 See Also

ReadOnly Property


Locked Property Applies To

TextBox Control


ReadOnly Property

See Also	Applies To

Returns or sets a value indicating whether an object can be edited.

Syntax

object.ReadOnly [ = boolean]

The ReadOnly property syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

boolean	A Boolean expression that specifies whether the control can be edited, as described in Settings.

Settings

The settings for boolean are:

Setting	Description

True	Data control [image] the control's Database object is opened with read-only access to data.  Changes to the data aren't allowed.

FileListBox control [image] the control includes read-only files in the list.

False	(Default) Data control [image] the control's Database is opened with read/write access to data.

FileListBox control [image] no read-only files are listed in the control.


ReadOnly Property Applies To

FileListBox Control


 See Also

Locked Property


GridLineWidth Property

See Also	Applies To

Returns or sets the width in pixels of the gridlines for a Grid control.

Syntax

object.GridLineWidth [= value]

The GridLineWidth property syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

value	An integer specifying the gridline width.  The minimum setting is 1 (default); the maximum setting is 10.


See Also

GridLines Property


GridLineWidth Property Applies To

Grid Control


LinkTopic Property

See Also	Applies To

For a destination control [image] returns or sets the source application and the topic (the fundamental data grouping used in that application).  Use LinkTopic with the LinkItem property to specify the complete data link.

For a source form [image] returns or sets the topic that the source form responds to in a DDE conversation.

Syntax

object.LinkTopic [= value]

The LinkTopic property syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

value	A string expression specifying a DDE syntax element.

Remarks

The LinkTopic property consists of a string that supplies part of the information necessary to set up either a destination link or source link.  The string you use depends on whether you're working with a destination control or a source form.  Each string corresponds to one or more elements of standard DDE syntax, which include application, topic, and item.

Note   While the standard definition for a DDE link includes the application, topic, and item elements, the actual syntax used within applications for a destination link to a source application may vary slightly.  For example, within Microsoft Excel, you use the syntax:

application|topic!item

Within Microsoft Word for Windows, you use:

application topic item

(Don't use the pipe character [|] or exclamation mark [!].)

Within a Visual Basic application, you use:

application|topic

The exclamation mark for topic is implicit.

Destination Control  To set LinkTopic for a destination control, use a string with the syntax application|topic as follows:

application is the name of the application from which data is requested, usually the executable filename without an extension [image] for example, Excel (for Microsoft Excel).

The pipe character (|, or character code 124) separates the application from the topic.

topic is the fundamental data grouping used in the source application [image] for example, a worksheet in Microsoft Excel.

In addition, for a destination control only, you must set the related LinkItem property to specify the item element for the link.  A cell reference, such as R1C1, corresponds to an item in a Microsoft Excel worksheet.

Source Form  To set LinkTopic for a source form, set value to an appropriate identifier for the form.  A destination application uses this string as the topic argument when establishing a DDE link with the form.  Although this string is all you need to set LinkTopic within Visual Basic for a source form, the destination application also needs to specify:

The application element that the destination application uses, which is either the Visual Basic project filename without the .VBP extension (if you're running your application in the Visual Basic development environment) or the Visual Basic application filename without the .EXE extension (if you're running your application as a stand-alone executable file).  The EXEName property of the App object provides this string in your Visual Basic code unless the filename was changed by the user.  (EXEName always returns the actual filename of the application on disk; DDE always uses the original name that was specified in the Make EXE dialog box.)

The item element that the destination application uses, which corresponds to the Name property setting for the Label, PictureBox, or TextBox control on the source form.

The following syntax is an example of a valid reference from Microsoft Excel to a Visual Basic application acting as a source:

=VizBasicApplication|FormN!TextBox1

You could enter this reference for a destination cell in the Microsoft Excel formula bar.

To activate the data link set with LinkTopic, set the LinkMode property to the appropriate nonzero value to specify the type of link you want.  As a general rule, set LinkMode after you set LinkTopic.  For a destination control, changing LinkTopic breaks an existing link and terminates the DDE conversation.  For a source form, changing LinkTopic breaks all destination links that are using that topic.  For these reasons, always set the LinkMode property to 0 before changing LinkTopic.  After changing LinkTopic for a destination control, you must set LinkMode to 1 (Automatic), 2 (Manual), or 3 (Notify) to establish a conversation with the new topic.

Note   Setting a permanent data link at design time with the Paste Link command on the Edit menu also sets the LinkMode, LinkTopic, and LinkItem properties.  This creates a link that is saved with the form.  Each time the form is loaded, Visual Basic attempts to reestablish the conversation.


See Also

LinkClose Event

LinkError Event

LinkItem Property

LinkMode Property

LinkOpen Event

LinkSend Method


LinkTopic Property Applies To

Form Object

Label Control

MDIForm Object

PictureBox Control

TextBox Control


Max, Min Properties (Scroll Bar)

See Also	Applies To

Max [image] returns or sets a scroll bar position's maximum Value property setting when the scroll box is in its bottom or rightmost position.

Min [image] 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 Max and Min property syntaxes have these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

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 [image] 32,767.

Min [image] 0.

Remarks

The Microsoft Windows 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 [image] 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 [image] 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.


See Also

LargeChange, SmallChange Properties


Max, Min Properties Apply To

HScrollBar, VScrollBar Controls


MaxFileSize Property

See Also	Applies To

Returns or sets the maximum size of the filename opened using the CommonDialog control.

Syntax

object.MaxFileSize [= value]

The MaxFileSize property syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

value	An integer specifying the maximum size of the filename in bytes.  The range for this property is 1 [image] 32K.  The default is 256.


MaxFileSize Property Applies To

CommonDialog Control (File Dialog)


See Also

FileName Property


MaxLength Property

See Also	Applies To

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.

Syntax

object.MaxLength [= value]

The MaxLength property syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

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, indicating 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 is assigned to the Text property, and extra characters are truncated.  Changing this property doesn't affect the current contents of a TextBox but will affect any subsequent changes to the contents.


See Also

Len Function

MultiLine Property


MaxLength Property Applies To

TextBox Control


MDIChild Property

See Also	Applies To

Returns or sets a value indicating whether a form is displayed as an MDI child form inside an MDI form.  Read only at run time.

Syntax

object.MDIChild

The object placeholder represents an object expression that evaluates to an object in the Applies To list.

Settings

The MDIChild property settings are:

Setting	Description

True	The form is an MDI child form and is displayed inside the parent MDI form.

False	(Default) The form isn't an MDI child form.

Note   For Visual Basic in-process OLE server (DLL) considerations and restrictions that apply to this topic, see Make OLE DLL File Command.

Remarks

Use this property when creating a multiple-document interface (MDI) application.  At run time, forms with this property set to True are displayed inside an MDI form.  An MDI child form can be maximized, minimized, and moved, all inside the parent MDI form.

When working with MDI child forms, keep the following in mind:

At run time, when an MDI child form is maximized, its caption is combined with that of the parent MDI form.

At design time, an MDI child form is displayed like any other form because the form is displayed inside the parent form only at run time.  An MDI child form's icon in the Project window is different from icons for other kinds of forms.

MDI child forms can't be modal.

The initial size and placement of MDI child forms are controlled by the Microsoft Windows operating environment unless you specifically set them in the Load event procedure.

If an MDI child form is referenced before the parent is loaded, the parent MDI form is automatically loaded.  However, if the parent MDI form is referenced before loading an MDI child form, the child form isn't loaded.

Note   When running under the graphical environment of Microsoft Windows version 3.0 or later, all MDI child forms have sizable borders, a Control-menu box, and Minimize and Maximize buttons, regardless of the settings of the BorderStyle, ControlBox, MinButton, and MaxButton properties.

Any reference to an MDIForm object, including reading or setting properties, causes the form to load and become visible.


See Also

ActiveControl Property

ActiveForm Property

BorderStyle Property

ControlBox Property

MaxButton Property

MinButton Property

WindowList Property


MDIChild Property Applies To

Form Object


MouseIcon Property

See Also	Applies To

Sets a custom mouse icon.

Syntax

object.MouseIcon = LoadPicture(pathname)

object.MouseIcon = picture

The MouseIcon property syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

pathname	A string expression specifying the path and filename of the file containing the custom icon.

picture	The Picture property of a Form object, PictureBox control, or Image control.

Remarks

The MouseIcon property provides a custom icon that is used when the MousePointer property is set to 99.

Although Visual Basic 4.0 does not create cursor (.CUR) files, you can use the MouseIcon property to load either cursor or icon files.  This provides your program with easy access to custom cursors of any size, with any desired hot spot location.  The 32-bit version of Visual Basic does not load animated cursor (.ANI) files, even though 32-bit versions of Windows support these cursors.


See Also

DragIcon Property

Icon Property

MousePointer Property

Picture Property


MouseIcon Property Applies To

CheckBox Control

ComboBox Control

CommandButton Control

DirListBox Control

DriveListBox Control

FileListBox Control

Form Object

Frame Control

Grid Control

HScrollBar, VScrollBar Controls

Image Control

Label Control

ListBox Control

MDIForm Object

OptionButton Control

PictureBox Control

TextBox Control


MousePointer Property

See Also	Applies To

Returns or sets a value indicating the type of mouse pointer displayed when the mouse is over a particular part of an object at run time.

Syntax

object.MousePointer [= value]

The MousePointer property syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

value	An integer specifying the type of mouse pointer displayed, as described in Settings.

Settings

The settings for value are:

Setting	Description

0	(Default) Shape determined by the object.

1	Arrow.

2	Cross (cross-hair pointer).

3	I-Beam.

4	Icon (small square within a square).

5	Size (four-pointed arrow pointing north, south, east, and west).

6	Size NE SW (double arrow pointing northeast and southwest).

7	Size N S (double arrow pointing north and south).

8	Size NW SE (double arrow pointing northwest and southeast).

9	Size W E (double arrow pointing west and east).

10	Up Arrow.

11	Hourglass (wait).

12	No Drop.

13	Arrow and hourglass. (Only available in 32-bit Visual Basic.)

14	Arrow and question mark. (Only available in 32-bit Visual Basic.)

15	Size all. (Only available in 32-bit Visual Basic.)

99	Custom icon specified by the MouseIcon property.

Remarks

You can use this property when you want to indicate changes in functionality as the mouse pointer passes over controls on a form or dialog box.  The Hourglass setting (11) is useful for indicating that the user should wait for a process or operation to finish.

Note   When set for the Screen object, the mouse pointer may change across the entire screen.  If your application doesn't call the DoEvents function and isn't a 32-bit application, it overrides all MousePointer settings for all controls and other applications.  If your application calls DoEvents, the MousePointer property may temporarily change when over a custom control.


See Also

DragIcon Property

MouseIcon Property

MouseMove Event


MousePointer Property Applies To

CheckBox Control

ComboBox Control

CommandButton Control

DirListBox Control

DriveListBox Control

FileListBox Control

Form Object

Frame Control

Grid Control

HScrollBar, VScrollBar Controls

Image Control

Label Control

ListBox Control

MDIForm Object

OptionButton Control

PictureBox Control

TextBox Control


MultiLine Property

See Also	Applies To

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 in the Applies To list.

Settings

The MultiLine property settings are:

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 HScrollBar control (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.


See Also

Default Property

ScrollBars Property


MultiLine Property Applies To

TextBox Control


MultiSelect Property

See Also	Applies To

Returns or sets a value indicating whether a user can make multiple selections in a FileListBox or 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 in the Applies To list.

Settings

The MultiSelect property settings are:

Setting	Description

0	(Default) Multiple selection isn't 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.


See Also

AddItem Method

Clear Method

List Property

ListCount Property

NewIndex Property

RemoveItem Method

Selected Property

TopIndex Property


MultiSelect Property Applies To

FileListBox Control

ListBox Control


NewIndex Property

See Also	Applies To

Returns the index of the item most recently added to a ComboBox or ListBox control.

Syntax

object.NewIndex

The object placeholder represents an object expression that evaluates to an object in the Applies To list.

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.


See Also

AddItem Method

Clear Method

ItemData Property

List Property

ListCount Property

MultiSelect Property

RemoveItem Method

Selected Property

TopIndex Property


NewIndex Property Applies To

ComboBox Control

ListBox Control


Orientation Property

Returns or sets a value indicating whether documents are printed in portrait or landscape mode.  Not available at design time.

Syntax

object.Orientation [= value]

The Orientation property syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

value	A value or constant that determines the page orientation, as described in Settings.

Settings

The settings for value are:

Constant	Value	Description

vbPRORPortrait	1	Documents are printed with the top at the narrow side of the paper.

vbPRORLandscape	2	Documents are printed with the top at the wide side of the paper.

Remarks

These constants are listed in the Visual Basic (VB) object library in the Object Browser.

Note   The effect of the properties of the Printer object depends on the driver supplied by the printer manufacturer.  Some property settings may have no effect, or several different property settings may all have the same effect.  Settings outside the accepted range may or may not produce an error.  For more information, see the manufacturer's documentation for the specific driver.


Page Property

Returns the current page number.

Syntax

object.Page

The object placeholder represents an object expression that evaluates to an object in the Applies To list.

Remarks

Visual Basic keeps a count of pages that have been printed since your application started or since the last time the EndDoc statement was used on the Printer object.  This count starts at one and increases by one if:

You use the NewPage method.

You use the Print method and the text you want to print doesn't fit on the current page.

Note   Graphics methods output that doesn't fit on the page doesn't generate a new page.  The output is clipped to fit the page's printable area.


See Also

EndDoc Method

NewPage Method

Print Method


PaperBin Property

Returns or sets a value indicating the default paper bin on the printer from which paper is fed when printing.  Not available at design time.

Syntax

object.PaperBin [= value]

The PaperBin property syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

value	A value or constant specifying the default paper bin, as described in Settings.

Settings

The settings for value are:

Constant	Value	Description

vbPRBNUpper	1	Use paper from the upper bin.

vbPRBNLower	2	Use paper from the lower bin.

vbPRBNMiddle	3	Use paper from the middle bin.

vbPRBNManual	4	Wait for manual insertion of each sheet of paper.

vbPRBNEnvelope	5	Use envelopes from the envelope feeder.

vbPRBNEnvManual	6	Use envelopes from the envelope feeder, but wait for manual insertion.

vbPRBNAuto	7	(Default) Use paper from the current default bin.

vbPRBNTractor	8	Use paper fed from the tractor feeder.

vbPRBNSmallFmt	9	Use paper from the small paper feeder.

vbPRBNLargeFmt	10	Use paper from the large paper bin.

vbPRBNLargeCapacity	11	Use paper from the large capacity feeder.

vbPRBNCassette	14	Use paper from the attached cassette cartridge.

Remarks

These constants are listed in the Visual Basic (VB) object library in the Object Browser.

Not all of the bin options are available on every printer.  Check the printer documentation for more specific descriptions of these options.

Note   The effect of the properties of the Printer object depends on the driver supplied by the printer manufacturer.  Some property settings may have no effect, or several different property settings may all have the same effect.  Settings outside the accepted range may or may not produce an error.  For more information, see the manufacturer's documentation for the specific driver.


PaperSize Property

Returns or sets a value indicating the paper size for the current printer.  Not available at design time.

Syntax

object.PaperSize [= value]

The PaperSize property syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

value	A value or constant specifying the paper size, as described in Settings.

Settings

The settings for value are:

Constant	Value	Description

vbPRPSLetter	1	Letter, 8 1/2 x 11 in.

vbPRPSLetterSmall	2	Letter Small, 8 1/2 x 11 in.

vbPRPSTabloid	3	Tabloid, 11 x 17 in.

vbPRPSLedger	4	Ledger, 17 x 11 in.

vbPRPSLegal	5	Legal, 8 1/2 x 14 in.

vbPRPSStatement	6	Statement, 5 1/2 x 8 1/2 in.

vbPRPSExecutive	7	Executive, 7 1/2 x 10 1/2 in.

vbPRPSA3	8	A3, 297 x 420 mm

vbPRPSA4	9	A4, 210 x 297 mm

vbPRPSA4Small	10	A4 Small, 210 x 297 mm

vbPRPSA5	11	A5, 148 x 210 mm

vbPRPSB4	12	B4, 250 x 354 mm

vbPRPSB5	13	B5, 182 x 257 mm

vbPRPSFolio	14	Folio, 8 1/2 x 13 in.

vbPRPSQuarto	15	Quarto, 215 x 275 mm

vbPRPS10x14	16	10 x 14 in.

vbPRPS11x17	17	11 x 17 in.

vbPRPSNote	18	Note, 8 1/2 x 11 in.

vbPRPSEnv9	19	Envelope #9, 3 7/8 x 8 7/8 in.

vbPRPSEnv10	20	Envelope #10, 4 1/8 x 9 1/2 in.

vbPRPSEnv11	21	Envelope #11, 4 1/2 x 10 3/8 in.

vbPRPSEnv12	22	Envelope #12, 4 1/2 x 11 in.

vbPRPSEnv14	23	Envelope #14, 5 x 11 1/2 in.

vbPRPSCSheet	24	C size sheet

vbPRPSDSheet	25	D size sheet

vbPRPSESheet	26	E size sheet

vbPRPSEnvDL	27	Envelope DL, 110 x 220 mm

vbPRPSEnvC3	29	Envelope C3, 324 x 458 mm

vbPRPSEnvC4	30	Envelope C4, 229 x 324 mm

vbPRPSEnvC5	28	Envelope C5, 162 x 229 mm

vbPRPSEnvC6	31	Envelope C6, 114 x 162 mm

vbPRPSEnvC65	32	Envelope C65, 114 x 229 mm

vbPRPSEnvB4	33	Envelope B4, 250 x 353 mm

vbPRPSEnvB5	34	Envelope B5, 176 x 250 mm

vbPRPSEnvB6	35	Envelope B6, 176 x 125 mm

vbPRPSEnvItaly	36	Envelope, 110 x 230 mm

vbPRPSEnvMonarch	37	Envelope Monarch, 3 7/8 x 7 1/2 in.

vbPRPSEnvPersonal	38	Envelope, 3 5/8 x 6 1/2 in.

vbPRPSFanfoldUS	39	U.S. Standard Fanfold, 14 7/8 x 11 in.

vbPRPSFanfoldStdGerman	40	German Standard Fanfold, 8 1/2 x 12 in.

vbPRPSFanfoldLglGerman	41	German Legal Fanfold, 8 1/2 x 13 in.

vbPRPSUser	256	User-defined

Remarks

These constants are listed in the Visual Basic (VB) object library in the Object Browser.

Setting a printer's Height or Width property automatically sets PaperSize to vbPRPSUser.

Note   The effect of the properties of the Printer object depends on the driver supplied by the printer manufacturer.  Some property settings may have no effect, or several different property settings may all have the same effect.  Settings outside the accepted range may or may not produce an error.  For more information, see the manufacturer's documentation for the specific driver.


PasswordChar Property

See Also	AppliesTo

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 PasswordChar property syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

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 doesn't 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.


See Also

Text Property


PasswordChar Property Applies To

TextBox Control


Pattern Property

See Also	Applies To

Returns or sets a value indicating the filenames displayed in a FileListBox control at run time.

Syntax

object.Pattern [= value]

The Pattern property syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

value	A string expression indicating a file specification, such as "*.*" or "*.FRM".  The default is "*.*", which returns a list of all files.  In addition to using wildcard characters, you can also use multiple patterns separated by semicolons (;).  For example, "*.EXE; *.BAT" would return a list of all executable files and all MS-DOS batch files.

Remarks

The Pattern property plays a key role in designing an application's file-browsing and manipulation capabilities.  Use Pattern in combination with other file-control properties to provide the user with ways to explore files or groups of similar files.  For example, in an application dedicated to launching other programs, you could designate that only .EXE files be displayed in the file list box (*.EXE).  Other key file-control properties include Drive, FileName, and Path.

Changing the value of the Pattern property generates a PatternChange event.


See Also

Archive, Hidden, Normal, System Properties

Drive Property

FileName Property

Path Property

PathChange Event

PatternChange Event


Pattern Property Applies To

FileListBox Control


Port Property

Returns the name of the port through which a document is sent to a printer.

Syntax

object.Port

The object placeholder represents an object expression that evaluates to an object in the Applies To list.

Remarks

The operating system determines the name of the port, such as LPT1: or LPT2:.

Note   The effect of the properties of the Printer object depends on the driver supplied by the printer manufacturer.  Some property settings may have no effect, or several different property settings may all have the same effect.  Settings outside the accepted range may or may not produce an error.  For more information, see the manufacturer's documentation for the specific driver.


PrevInstance Property

Applies To

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 in the Applies To list.

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 operating environment at a time.


PrevInstance Property Applies To

App Object


PrintQuality Property

Returns or sets a value indicating the printer resolution.  Not available at design time.

Syntax

object.PrintQuality [= value]

The PrintQuality property syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

value	A value or constant specifying printer resolution, as described in Settings.

Settings

The settings for value are:

Constant	Value	Description

vbPRPQDraft	-1	Draft resolution

vbPRPQLow	-2	Low resolution

vbPRPQMedium	-3	Medium resolution

vbPRPQHigh	-4	High resolution

In addition to the predefined negative values, you can also set value to a positive dots per inch (dpi) value, such as 300.

Remarks

These constants are listed in the Visual Basic (VB) object library in the Object Browser.

The default value depends on the printer driver and the current settings of the printer.  The effect of these settings varies among printers and printer drivers.  On some printers, some or all of the settings may produce the same result.

Note   The effect of the properties of the Printer object depends on the driver supplied by the printer manufacturer.  Some property settings may have no effect, or several different property settings may all have the same effect.  Settings outside the accepted range may or may not produce an error.  For more information, see the manufacturer's documentation for the specific driver.


RowHeight Property

See Also	Applies To

For a Grid control, returns or sets the height of the specified row (record) in twips.  Not available at design time.

For a DBGrid control, returns or sets the height of all rows in the control.  RowHeight is always in the same unit of measure as the container for the DBGrid control.

Syntax

object.RowHeight[(number)] [= value ]

The RowHeight property syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

number	The number of the row in a Grid control.

value	A numeric expression specifying height.

Remarks

For a Grid control, the minimum RowHeight is 1 pixel.  Users can change the RowHeight of any row at run time by placing the mouse pointer on a gridline between rows and dragging.


See Also

ColWidth Property

Col, Row Properties


RowHeight Property Applies To

Grid Control


ScaleHeight, ScaleWidth Properties

See Also	Applies To

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.  For MDIForm objects, not available at design time and read-only at run time.

Syntax

object.ScaleHeight [= value]

object.ScaleWidth [= value]

The ScaleHeight and ScaleWidth property syntaxes have these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

value	A numeric expression specifying the horizontal or vertical measurement.

Remarks

You can use these properties to create a custom coordinate scale for drawing or printing.  For example, the statement ScaleHeight = 100 defines the interior height of a section as 100 units or one vertical unit as 1/100 of the height.

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.

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 aren't the same as the Height and Width properties.

For MDIForm objects, ScaleHeight and ScaleWidth refer only to the area not covered by PictureBox controls in the form.  Avoid using these properties to size a PictureBox in the Resize event of an MDIForm.


See Also

CurrentX, CurrentY Properties

DrawMode Property

DrawStyle Property

FillColor Property

BackColor, ForeColor Properties

Height, Width Properties

Scale Method

ScaleLeft, ScaleTop Properties

ScaleMode Property


ScaleHeight, ScaleWidth Properties Apply To

Form Object

MDIForm Object

PictureBox Control


ScaleLeft, ScaleTop Properties

See Also	Applies To

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 ScaleLeft and ScaleTop property syntaxes have these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

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.

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 aren't the same as the Left and Top properties.


See Also

DrawMode Property

DrawStyle Property

FillColor Property

BackColor, ForeColor Properties

Left, Top Properties

Scale Method

ScaleHeight, ScaleWidth Properties

ScaleMode Property


ScaleLeft, ScaleTop Properties Apply To

Form Object

PictureBox Control


ScaleMode Property

See Also	Applies To

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 ScaleMode property syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

value	An integer specifying the unit of measurement, as described in Settings.

Settings

The settings for value are:

Setting	Description

0	Indicates that one or more of the ScaleHeight, ScaleWidth, ScaleLeft, and ScaleTop properties are set to custom values.

1	(Default) Twip (1440 twips per logical inch; 567 twips per logical centimeter).

2	Point (72 points per logical inch).

3	Pixel (smallest unit of monitor or printer resolution).

4	Character (horizontal = 120 twips per unit; vertical = 240 twips per unit).

5	Inch.

6	Millimeter.

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.

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.


See Also

DrawMode Property

DrawStyle Property

FillColor Property

Scale Method

ScaleHeight, ScaleWidth Properties

ScaleLeft, ScaleTop Properties


ScaleMode Property Applies To

Form Object

PictureBox Control


ScrollBars Property

See Also	Applies To

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 in the Applies To list.

Settings

For an MDIForm object, the ScrollBars property settings are:

Setting	Description

True	(Default) The form has a horizontal or vertical scroll bar, or both.

False	The form has no scroll bars.

For a Grid or TextBox control, the ScrollBars property settings are:

Setting	Description

0	(Default) None

1	Horizontal

2	Vertical

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 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.  For example, in an MDIForm object, if part of a child form is hidden behind the border of the parent MDI form, a horizontal scroll bar (HScrollBar control) is displayed.  Similarly, a vertical scroll bar (VScrollBar control) is displayed on a Grid control when it can't display all of its rows; a vertical scroll bar appears on a TextBox control when it can't display all of its lines of text.  If ScrollBars is set to False, the object won't have scroll bars, regardless of its contents.


See Also

MultiLine Property

WordWrap Property


ScrollBars Property Applies To

Grid Control

MDIForm Object

TextBox Control


SelCount Property

See Also	Applies To

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 in the Applies To list.

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.


See Also

AddItem Method

List Property

ListIndex Property

MultiSelect Property

NewIndex Property

RemoveItem Method

Selected Property

TopIndex Property


SelCount Property Applies To

ListBox Control


Selected Property

See Also	Applies To

Returns or sets the selection status of an item in a FileListBox or 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 Selected property syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

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:

Setting	Description

True	The item is selected.

False	(Default) The item isn't 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 only one item is selected, 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.


See Also

AddItem Method

Clear Method

List Property

ListCount Property

ListIndex Property

MultiSelect Property

NewIndex Property

RemoveItem Method

TopIndex Property


Selected Property Applies To

FileListBox Control

ListBox Control


SelEndCol, SelStartCol, SelEndRow, SelStartRow Properties

See Also	Applies To

Return or set the first or last row or column for a range of cells.  Not available at design time.

SelEndCol [image] the last selected column on the right.

SelStartCol [image] the first selected column on the left.

SelEndRow [image] the last selected row.

SelStartRow [image] the first selected row.

Syntax

object.SelEndCol [= value ]

object.SelStartCol [= value]

object.SelEndRow [= value]

object.SelStartRow [= value]

The SelEndCol, SelStartCol, SelEndRow, and SelStartRow property syntaxes have these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

value	A numeric expression specifying the first or last column or row.

Remarks

You can use these properties to select a specific region of a Grid control from code or to return in code the dimensions of an area that the user selects.

SelStartCol and SelStartRow together specify the cell in the upper-left corner of a selected range.  SelEndCol and SelEndRow specify the cell in the lower-right corner of a selected range.

To specify a cell without moving the current selection, use the Col and Row properties.

The default value for SelStartCol and SelEndCol is -1.


See Also

Col, Row Properties


SelEndCol, SelStartCol, SelEndRow, SelStartRow Properties Apply To

Grid Control


SelLength, SelStart, SelText Properties

See Also	Applies To

SelLength [image] returns or sets the number of characters selected.

SelStart [image] returns or sets the starting point of text selected; indicates the position of the insertion point if no text is selected.

SelText [image] returns or sets the string containing the currently selected text; consists of a zero-length string ("") if no characters are selected.

These properties aren't available at design time.

Syntax

object.SelLength [= number]

object.SelStart [= index]

object.SelText [= value]

The SelLength, SelStart, and SelText property syntaxes have these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

number	A numeric expression specifying the number of characters selected.  For SelLength and SelStart, the valid range of settings is 0 to text length [image] 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:

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.


See Also

ActiveControl Property

ActiveForm Property

Text Property


SelLength, SelStart, SelText Properties Apply To

ComboBox Control

TextBox Control


Shape Property

See Also	Applies To

Returns or sets a value indicating the appearance of a Shape control.

Syntax

object.Shape [= value]

The Shape property syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

value	An integer specifying the control's appearance, as described in Settings.

Settings

The settings for value are:

Setting	Description

0	(Default) Rectangle

1	Square

2	Oval

3	Circle

4	Rounded Rectangle

5	Rounded Square


See Also

BorderStyle Property


Shape Property Applies To

Shape Control


Shortcut Property

See Also	Applies To

Sets a value that specifies a shortcut key for a Menu object.  Not available at run time.

Remarks

Use this property to provide keyboard shortcuts for menu commands.  You can set this property using the Menu Editor.  For a list of shortcut keys you can use, see the Shortcut list in the Menu Editor.

Note   In addition to shortcut keys, you can also assign access keys to commands, menus, and controls by using an ampersand (&) in the Caption property setting.


See Also

Caption Property


Shortcut Property Applies To

Menu Object


Stretch Property

See Also	Applies To

Returns or sets a value indicating whether a graphic resizes to fit the size of an Image control.

Syntax

object.Stretch [= boolean]

The Stretch property syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

boolean	A Boolean expression specifying whether the graphic resizes, as described in Settings.

Settings

The settings for boolean are:

Setting	Description

True	The graphic resizes to fit the control.

False	(Default) The control resizes to fit the graphic.

Remarks

If Stretch is set to True, resizing the control also resizes the graphic it contains.


See Also

Image Property

Picture Property


Stretch Property Applies To

Image Control


Style Property

See Also	Applies To

Returns or sets a value indicating the type of combo box and the behavior of its list box portion.  Read only at run time.

Syntax

object.Style

The object placeholder represents an object expression that evaluates to an object in the Applies To list.

Settings

The Style property settings are:

Setting	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 doesn't 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 only allows selection from the drop-down list.

Remarks

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.


See Also

Change Event

Click Event

DblClick Event

DropDown Event


Style Property Applies To

ComboBox Control


TabStop Property

See Also	Applies To

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 TabStop property syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

boolean	A Boolean expression specifying whether the object is a tab stop, as described in Settings.

Settings

The settings for boolean are:

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.  For example, if you're using a PictureBox control to draw a graphic, set its TabStop property to False, so the user can't tab to the PictureBox.


See Also

TabIndex Property


TabStop Property Applies To

CheckBox Control

ComboBox Control

CommandButton Control

DirListBox Control

DriveListBox Control

FileListBox Control

Grid Control

HScrollBar, VScrollBar Controls

ListBox Control

OptionButton Control

PictureBox Control

TextBox Control


Title Property

See Also	Applies To

Returns or sets the title of the application that is displayed in the Microsoft Windows Task List.  If changed at run time, changes aren't saved with the application.

Syntax

object.Title [= value]

The Title property syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

value	A string expression specifying the title of the application.  The maximum length of value is 40 characters.

Remarks

This property is available at design time in the dialog box for the Make EXE command on the File menu.


See Also

Caption Property


Title Property Applies To

App Object


TopIndex Property

See Also	Applies To

Returns or sets a value that specifies which item in a FileListBox or ListBox control is displayed in the topmost position.  Not available at design time.

Syntax

object.TopIndex [= value]

The TopIndex property syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

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 FileListBox or ListBox 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.


See Also

AddItem Method

Clear Method (Clipboard, ComboBox, ListBox)

Columns Property (ListBox)

List Property

ListCount Property

MultiSelect Property

NewIndex Property

RemoveItem Method

Selected Property


TopIndex Property Applies To

FileListBox Control

ListBox Control


TopRow Property

See Also	Applies To

Returns or sets the topmost row displayed in a Grid control.  Not available at design time.

Syntax

object.TopRow [= value ]

The TopRow property syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

value	The number of the topmost row displayed.

Remarks

You can use this property in code to programmatically read or set the visible top row of the Grid control.  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 generate an error.


See Also

Col, Row Properties

LeftCol Property


TopRow Property Applies To

Grid Control


TwipsPerPixelX, TwipsPerPixelY Properties

See Also

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 in the Applies To list.

Remarks

Windows API routines generally require measurements in pixels.  You can use these properties to convert measurements quickly without changing an object's ScaleMode property setting.


See Also

ScaleHeight, ScaleWidth Properties

ScaleLeft, ScaleTop Properties

ScaleMode Property


WindowList Property

See Also	Applies To

Returns or sets a value that determines whether a Menu object maintains a list of the current MDI child windows in an MDIForm object.  Read only at run time.

Syntax

object.WindowList

The object placeholder represents an object expression that evaluates to an object in the Applies To list.

Settings

The WindowList property settings are:

Setting	Description

True	The Menu object maintains a list of open windows and displays a check mark next to the active window.  Users can click a window name to activate that window.

False	(Default) The Menu doesn't maintain a list of open windows.

Remarks

Many multiple-document interface (MDI) applications, such as Microsoft Excel and Microsoft Word for Windows, have a Window menu containing a list of open MDI child windows.  This property enables you to add this functionality to your application.

Only one Menu object on a form can have its WindowList property set to True.

When you select the WindowList check box in the Menu Editor for a Menu object, the list of open MDI child windows for the menu you're creating is displayed.


See Also

Caption Property

MDIForm Object


WindowList Property Applies To

Menu Object


WindowState Property

See Also	Applies To

Returns or sets a value indicating the visual state of a form window at run time.

Syntax

object.WindowState [= value]

The WindowState property syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

value	An integer specifying the state of the object, as described in Settings.

Settings

The settings for value are:

Setting	Description

0	(Default) Normal

1	Minimized (minimized to an icon)

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's 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.


See Also

Load Event

Paint Event

Resize Event


WindowState Property Applies To

Form Object

MDIForm Object


WordWrap Property

See Also	Applies To

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 WordWrap property syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

boolean	A Boolean expression specifying whether the Label expands to fit the text, as described in Settings.

Settings

The settings for boolean are:

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 doesn't change.

False	(Default) The text doesn't 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 don't 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 doesn't expand in any direction.


See Also

AutoSize Property

Caption Property


WordWrap Property Applies To

Label Control


X1, Y1, X2, Y2 Properties

See Also	Applies To

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 X1, Y1, X2, and Y2 property syntaxes have these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

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.


See Also

Left, Top Properties

Line Method


X1, Y1, X2, Y2 Properties Apply To

Line Control


ActiveControl Property

See Also	Applies To

Returns the control that has the focus.  When a form is referenced, as in ChildForm.ActiveControl, 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 in the Applies To list.

Note   For Visual Basic in-process OLE server (DLL) considerations and restrictions that apply to this topic, see Make OLE DLL File Command.

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 isn't the active form.

This property is especially useful in a multiple-document interface (MDI) application where a button on a toolbar must initiate an action on a control in an MDI child form.  When a user clicks the Copy button on the toolbar, your code can reference the text in the active control on the MDI child form, as in ActiveForm.ActiveControl.SelText.

Note   If you plan to pass Screen.ActiveControl to a procedure, you must declare the argument in that procedure with the clause As Control rather than specifying a control type (As TextBox or As ListBox) even if ActiveControl always refers to the same type of control.


See Also

ActiveForm Property

GotFocus Event

LostFocus Event


ActiveControl Property Applies To

Form Object

MDIForm Object


Appearance Property

See Also	Applies To

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

Important   16-bit versions of OLE controls do not provide this property.

Syntax

[object].Appearance

The object placeholder represents an object expression that evaluates to an object in the Applies To list.

Settings

The Appearance property settings are:

Setting	Description

0	Flat.  Paints controls and forms without visual effects.

1	(Default)  3D.  Paints controls with three-dimensional effects.

Remarks

If set to 1at design time, the Appearance property draws controls with three-dimensional effects.  If the form's BorderStyle property is set to Fixed Double (vbFixedDouble, 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 Button Face in the Color option of the operating system's Control Panel.

Setting the Appearance property to 1 for an MDIForm object affects only the MDI parent form.  To have three-dimensional effects on MDI child forms, you must set each child form's Appearance property to 1.


See Also

BackColor, ForeColor Properties

BorderStyle Property


Appearance Property Applies To

CheckBox Control

ComboBox Control

CommandButton Control

DirListBox Control

DriveListBox Control

FileListBox Control

Form Object

Frame Control

Image Control

Label Control

ListBox Control

MDIForm Object

OptionButton Control

PictureBox Control

TextBox Control


Bold Property

See Also

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

Syntax

object.Bold [= boolean]

The Bold property syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

boolean	A Boolean expression specifying the font style, as described in Settings.

Settings

The settings for boolean are:

Setting	Description

True	Turns on bold formatting.

False	(Default) Turns off bold formatting.

Remarks

The Font object isn't directly available at design time.  Instead you 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.


See Also

FontTransparent Property

Italic Property

Name Property

Size Property

StrikeThrough Property

Underline Property

Weight Property


FontTransparent Property

See Also	Applies To

Returns or sets a value that determines whether background text and graphics on a Form or Printer object or a PictureBox control are displayed in the spaces around characters.

Syntax

object.FontTransparent [= boolean]

The FontTransparent property syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

boolean	A Boolean expression specifying the state of background text and graphics, as described in Settings.

Settings

The settings for boolean are:

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 doesn't affect graphics and text already drawn to Form, Printer, or PictureBox.


See Also

Bold Property

Italic Property

Name Property

Size Property

StrikeThrough Property

Underline Property

Weight Property


FontTransparent Property Applies To

Form Object

PictureBox Control


Italic Property

See Also

Returns or sets the font style of the Font object to either italic or nonitalic.

Syntax

object.Italic [= boolean]

The Italic property syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

boolean	A Boolean expression specifying the font style as described in Settings.

Settings

The settings for boolean are:

Setting	Description

True	Turns on italic formatting.

False	(Default) Turns off italic formatting.

Remarks

The Font object isn't directly available at design time.  Instead you 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, you set Italic directly by specifying its setting for the Font object.


See Also

Bold Property

FontTransparent Property

Name Property

Size Property

StrikeThrough Property

Underline Property

Weight Property


LBound Property

See Also

Returns the lowest ordinal value of a control in a control array.

Syntax

object.LBound

The object placeholder represents an object expression that evaluates to an object in the Applies To list.

Remarks

The LBound property setting is equal to the Index property value of the first control in the array.  Typically this value is 0 because Visual Basic automatically assigns an Index value of 0 to the first control in a control array.  If you manually change the Index value for the first control in an array to some other value (for example, 1), LBound returns the value you manually assigned to Index (in this example, 1).


See Also

Count Property

Index Property

UBound Property


Size Property (Font)

See Also

Returns or sets the font size used in the Font object.

Syntax

object.Size [= number]

The Size property syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

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 isn't directly available at design time.  Instead you 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.


See Also

Bold Property

FontTransparent Property

Italic Property

Name Property

StrikeThrough Property

Underline Property

Weight Property


StartMode Property

See Also	Applies To

Returns or sets a value that determines whether an application starts as a stand-alone project or as an OLE Automation OLE server.  Read-only at run time.

Syntax

object.StartMode

The object placeholder represents an object expression that evaluates to an object in the Applies To list.

Settings

The StartMode property settings are:

Constant	Value	Description

vbSModeStandalone	0	(Default) Application starts as a stand-alone project.

vbSModeAutomation	1	Application starts as an OLE Automation OLE server.

Remarks

At design time, you can set StartMode in the Project Options dialog box to 1 (vbSModeAutomation) to debug an application as if it were started as an OLE Automation OLE server.  But a project's actual StartMode setting is determined by how that application is started at run time, not by its nominal setting in the Project Options dialog box when you create an executable (.EXE) file.

When StartMode is set to 1 and there are no public classes in the project, you must use the End statement or choose End from the Run menu or toolbar to end the application.  If you choose Close from the Control menu, the form closes but the project is still running.


See Also

Path Property

PrevInstance Property

Title Property


StartMode Property Applies To

App Object


StrikeThrough Property

See Also

Returns or sets the font style of the Font object to either strikethrough or nonstrikethrough.

Syntax

object.StrikeThrough [= boolean]

The StrikeThrough property syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

boolean	A Boolean expression specifying the font style, as described in Settings.

Settings

The settings for boolean are:

Setting	Description

True	Turns on strikethrough formatting.

False	(Default) Turns off strikethrough formatting.

Remarks

The Font object isn't 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.


See Also

Bold Property

FontTransparent Property

Italic Property

Name Property

Size Property (Font)

Underline Property

Weight Property


TrackDefault Property

See Also

Returns or sets a value that determines whether the Printer object always points to the same printer or changes the printer it points to if you change the default printer setting in the operating system's Control Panel.  Not available at design time.

Syntax

object.TrackDefault [= boolean]

The TrackDefault property syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

boolean	A Boolean expression specifying the printer object points to, as described in Settings.

Settings

The settings for boolean are:

Setting	Description

True	(Default) The Printer object changes the printer it points to when you change the default printer settings in the operating system's Control Panel.

False	The Printer object continues to point to the same printer even though you change the default printer settings in the operating system's Control Panel.

Remarks

Changing the TrackDefault property setting while a print job is in progress sends an implicit EndPage statement to the Printer object.


See Also

ColorMode Property

Copies Property

EndDoc Method

PaperBin Property

PrintQuality Property

Height, Width Properties


Type Property (Picture)

See Also

Returns the graphic format of a Picture object.  Not available at design time; read-only at run time.

Syntax

object.Type

The object placeholder represents an object expression that evaluates to an object in the Applies To list.

Return Valuess

The return values for the Type property are:

Constant	Value	Description

vbPicTypeBitmap	1	Bitmap (.BMP files)

vbPicTypeMetafile	2	Metafile (.WMF files)

vbPicTypeIcon	3	Icon (.ICO files)

Remarks

These constants are listed in the Visual Basic (VB) object library in the Object Browser.


See Also

Height, Width Properties


UBound Property

See Also

Returns the highest ordinal value of a control in a control array.

Syntax

object.UBound

The object placeholder represents an object expression that evaluates to an object in the Applies To list.

Remarks

UBound is equal to the Index property value of the last control in the array.


See Also

Index Property


Underline Property

See Also

Returns or sets the font style of the Font object to either underlined or nonunderlined.

Syntax

object.Underline [= boolean]

The Underline property syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

boolean	A Boolean expression specifying the font style, as described in Settings.

Settings

The settings for boolean are:

Setting	Description

True	Turns on underline formatting.

False	(Default) Turns off underline formatting.

Remarks

The Font object isn't directly available at design time.  Instead you 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.


See Also

Bold Property

FontTransparent Property

Italic Property

Name Property

Size Property (Font)

StrikeThrough Property

Weight Property


UseMnemonic Property

See Also	Applies To

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 UseMnemonic property syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

boolean	A Boolean expression specifying whether the Label control enables an access key, as described in Settings.

Settings

The settings for boolean are:

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 isn't 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.


See Also

Caption Property


UseMnemonic Property Applies To

Label Control


Weight Property

See Also

Returns or sets the weight of the characters that make up a Font object.

Syntax

object.Weight [= number]

The Weight property syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

number	A numeric expression specifying the weight of the font.

Remarks

The Font object isn't 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.


See Also

Bold Property

FontTransparent Property

Italic Property

Name Property

Size Property (Font)

StrikeThrough Property

Underline Property


ActiveForm Property

See Also	Applies To

Returns the form that is the active window.  If an MDIForm object is active or is referenced, it specifies the active MDI child form.

Note   For Visual Basic in-process OLE server (DLL) considerations and restrictions that apply to this topic, see Make OLE DLL File Command.

Syntax

object.ActiveForm

The object placeholder represents an object expression that evaluates to an object in the Applies To list.

Remarks

Use the ActiveForm property to access a form's properties or to invoke its methods [image] for example, Screen.ActiveForm.MousePointer = 4.

This property is especially useful in a multiple-document interface (MDI) application where a button on a toolbar must initiate an action on a control in an MDI child form.  When a user clicks the Copy button on the toolbar, your code can reference the text in the active control on the MDI child form [image] for example, ActiveForm.ActiveControl.SelText.

When a control on a form has the focus, that form is the active form on the screen (Screen.ActiveForm).  In addition, an MDIForm object can contain one child form that is the active form within the context of the MDI parent form (MDIForm.ActiveForm).  The ActiveForm on the screen isn't necessarily the same as the ActiveForm in the MDI form, such as when a dialog box is active.  For this reason, specify the MDIForm with ActiveForm when there is a chance of a dialog box being the ActiveForm property setting.

Note   When an active MDI child form isn't maximized, the title bars of both the parent form and the child form appear active.

If you plan to pass Screen.ActiveForm or MDIForm.ActiveForm to a procedure, you must declare the argument in that procedure with the generic type (As Form) rather than a specific form type (As MyForm) even if ActiveForm always refers to the same type of form.

The ActiveForm property determines the default value for the ProjectTemplate object.


See Also

Activate, Deactivate Events

MDIChild Property


ActiveForm Property Applies To

MDIForm Object


Caption Property

See Also	Applies To

Form [image] determines the text displayed in the Form or MDIForm object's title bar.  When the form is minimized, this text is displayed below the form's icon.

Control [image] determines the text displayed in or next to a control.

MenuLine object [image] determines the text displayed for a Menu control or an object in the MenuItems collection.

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.

Syntax

object.Caption [= string]

The Caption property syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.  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.

For a Label control, the caption is limited to 2048 characters.  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 either Fixed Single (1 or vbFixedSingle), Sizable (2 or vbSizable), or Fixed Double (3 or vbFixedDouble).  A caption too long for the form's title bar is clipped.  When an MDI child form is maximized within an MDIForm object, the child form's caption is included in the parent form's caption.

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


See Also

AutoSize Property

BorderStyle Property

Name Property


Caption Property Applies To

CheckBox Control

CommandButton Control

Form Object

Frame Control

Label Control

MDIForm Object

Menu Control

OptionButton Control


Checked Property

See Also	Applies To

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

Syntax

object.Checked [= boolean]

The Checked property syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

boolean	A Boolean expression that specifies whether a check mark is displayed next to a menu item.

Settings

The settings for boolean are:

Setting	Description

True	Places a check mark next to a menu item.

False	(Default) Doesn't 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.

For a Menu control, Checked is normally read/write at run time.  But Checked is read-only for menu items that are exposed or supplied by Visual Basic to add-ins, such as the Add-In Manager command on the Add-Ins menu.


See Also

Enabled Property

Load Event

Visible Property


Checked Property Applies To

Menu Control


Count Property (VB Collections)

Applies To

Returns the number of objects in a collection.

Syntax

object.Count

The object placeholder is an object expression that evaluates to an object in the Applies To list.

Remarks

You can use this property with a For...Next statement to carry out an operation on the forms or controls in a collection.  For example, the following code moves all controls on a form 0.5 inches to the right (ScaleMode property setting is 1 or vbTwips):

For I = 0 To Form1.Controls.Count - 1

Form1.Controls(I).Left = Form1.Controls(I).Left + 720

Next I

You can also use this kind of structure to quickly enable or disable all controls on a form.

When used with the If TypeOf statement, you can cycle through all controls and change, for example, the Enabled property setting of only the text boxes or the BackColor property setting of only the option buttons.

Note   The Count property of the SelectedComponents collection, which is exposed by Visual Basic to add-ins, is never greater than 1 in Visual Basic version 4.0.


Count Property Applies To

Controls Collection

Form Object

Forms Collection


Enabled Property

See Also	Applies To

Returns or sets a value that determines whether a form or control can respond to user-generated events.

Syntax

object.Enabled [= boolean]

The Enabled property syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.  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:

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 don't 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.

For a Menu control, Enabled is normally read/write at run time.  But Enabled is read-only for menu items that are exposed or supplied by Visual Basic to add-ins, such as the Add-In Manager command on the Add-Ins menu.


See Also

Interval Property


Enabled Property Applies To

CheckBox Control

ComboBox Control

CommandButton Control

DirListBox Control

DriveListBox Control

FileListBox Control

Form Object

Frame Control

Grid Control

HScrollBar, VScrollBar Controls

Image Control

Label Control

ListBox Control

MDIForm Object

Menu Control

OptionButton Control

PictureBox Control

TextBox Control

Timer Control


HelpContextID Property

Applies To

Returns or sets an associated context number for an object.  Used to provide context-sensitive Help for your application.

Syntax

object.HelpContextID [= number]

The HelpContextID property syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.  If object is omitted, the form associated with the active form module is assumed to be object.

number	A numeric expression that specifies the context number of the Help topic associated with object.

Settings

The settings for number are:

Setting	Description

0	(Default) No context number specified.

> 0	An integer specifying a valid context number.

Remarks

For context-sensitive Help on an object in your application, you must assign the same context number to both object and to the associated Help topic when you compile your Help file.

If you've created a Microsoft Windows operating environment Help file for your application and set the application's HelpFile property, when a user presses the F1 key, Visual Basic automatically calls Help and searches for the topic identified by the current context number.

The current context number is the value of HelpContextID for the object that has the focus.  If HelpContextID is set to 0, then Visual Basic looks in the HelpContextID of the object's container, and then that object's container, and so on.  If a nonzero current context number can't be found, the F1 key is ignored.

For a Menu control, HelpContextID is normally read/write at run time.  But HelpContextID is read-only for menu items that are exposed or supplied by Visual Basic to add-ins, such as the Add-In Manager command on the Add-Ins menu.

Note   Building a Help file requires the Microsoft Windows Help Compiler, which is included with the Visual Basic Professional Edition.


HelpContextID Property Applies To

CheckBox Control

ComboBox Control

CommandButton Control

DirListBox Control

DriveListBox Control

FileListBox Control

Form Object

Frame Control

Grid Control

HScrollBar, VScrollBar Controls

ListBox Control

MDIForm Object

Menu Control

OptionButton Control

PictureBox Control

TextBox Control


Index Property (Control Array)

See Also	Applies To

Returns or sets the number that uniquely identifies a control in a control array.  Available only if the control is part of a control array.

Syntax

object[(number)].Index

The Index property syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

number	A numeric expression that evaluates to an integer that identifies an individual control within a control array.

Settings

The settings for number are:

Setting	Description

No value	(Default) Not part of a control array.

0 to 32,767	Part of an array.  Specifies an integer greater than or equal to 0 that identifies a control within a control array.  All controls in a control array have the same Name property.  Visual Basic automatically assigns the next integer available within the control array.

Remarks

Because control array elements share the same Name property setting, you must use the Index property in code to specify a particular control in the array.  Index must appear as an integer (or a numeric expression evaluating to an integer) in parentheses next to the control array name [image] for example, MyButtons(3).  You can also use the Tag property setting to distinguish one control from another within a control array.

When a control in the array recognizes that an event has occurred, Visual Basic calls the control array's event procedure and passes the applicable Index setting as an additional argument.  This property is also used when you create controls dynamically at run time with the Load statement or remove them with the Unload statement.

Although Visual Basic assigns, by default, the next integer available as the value of Index for a new control in a control array, you can override this assigned value and skip integers.  You can also set Index to an integer other than 0 for the first control in the array.  If you reference an Index value in code that doesn't identify one of the controls in a control array, a Visual Basic run-time error occurs.

Note   To remove a control from a control array, change the control's Name property setting, and delete the control's Index property setting.


See Also

Name Property

Tag Property


Index Property Applies To

CheckBox Control

ComboBox Control

CommandButton Control

CommonDialog Control

DirListBox Control

DriveListBox Control

FileListBox Control

Frame Control

Grid Control

HScrollBar, VScrollBar Controls

Image Control

Label Control

Line Control

ListBox Control

Menu Control

OptionButton Control

PictureBox Control

Shape Control

TextBox Control

Timer Control


Name Property

See Also	Applies To

Returns the name used in code to identify a form, control, or data access object.

Syntax

object.Name

The object placeholder represents an object expression that evaluates to an object in the Applies To list.  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.  For example, the first new Form object is Form1, a new MDIForm object is MDIForm1, and the third TextBox control you create on a form is Text3.

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 can't include punctuation or spaces.  Forms can't 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.

You can use a form's Name property with the Dim statement at run time to create other instances of the form.  You can't have two forms with the same name at design time.

You can create an array of controls of the same type by setting the Name property to the same value.  For example, when you set the name of all option buttons in a group to MyOpt, Visual Basic assigns unique values to the Index property of each control to distinguish it from others in the array.  Two controls of different types can't share the same name.

For the Application object that is exposed or supplied by Visual Basic to add-ins, the Name property setting is always Microsoft Visual Basic.  For a Property object that is exposed or supplied by Visual Basic to add-ins, the Name property setting is the same as the name listed in the Visual Basic (VB) object library in the Object Browser.

Note   Although Visual Basic often uses the Name property setting as the default value for the Caption, LinkTopic, and Text properties, changing one of these properties doesn't affect the others.


See Also

ActiveForm Property

Caption Property

Index Property (Control Array)

LinkTopic Property

Text Property


Name Property Applies To

CheckBox Control

ComboBox Control

CommandButton Control

CommonDialog Control

DirListBox Control

DriveListBox Control

FileListBox Control

Form Object

Frame Control

Grid Control

HScrollBar, VScrollBar Controls

Image Control

Label Control

Line Control

ListBox Control

MDIForm Object

OptionButton Control

PictureBox Control

Shape Control

TextBox Control

Timer Control


Parent Property

See Also	Applies To

Returns the form, object, or collection that contains a control or another object or collection.

Syntax

object.Parent

The object placeholder represents an object expression that evaluates to an object in the Applies To list.

Remarks

Use the Parent property to access the properties, methods, or controls of an object's parent.  For example:

MyButton.Parent.MousePointer = 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.

There is no relationship between the Parent property and the MDIChild property.  There is, however, a parent-child relationship between an MDIForm object and any Form object that has its MDIChild property set to True.


See Also

ActiveControl Property

ActiveForm Property

MDIChild Property


Parent Property Applies To

CheckBox Control

ComboBox Control

CommandButton Control

CommonDialog Control

DirListBox Control

DriveListBox Control

Frame Control

Grid Control

HScrollBar, VScrollBar Controls

Image Control

Label Control

Line Control

ListBox Control

OptionButton Control

PictureBox Control

Shape Control

TextBox Control

Timer Control


Path Property

See Also	Applies To

Returns or sets the current path.  Not available at design time.  For the App object, read-only at run time.

Syntax

object.Path [= pathname]

The Path property syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

pathname	A string expression that evaluates to the path name.

Remarks

The value of the Path property is a string indicating a path, such as C:\OB or C:\WINDOWS\SYSTEM.  For a DirListBox or FileListBox control, the default is the current path when the control is created at run time.  For the App object, Path specifies the path of the project .VBP file when running the application from the development environment or the path of the .EXE file when running the application as an executable file.

Use this property when building an application's file-browsing and manipulation capabilities.  Setting the Path property has effects on a control similar to the MS-DOS chdir command [image] relative paths are allowed with or without a drive specification.  Specifying only a drive with a colon (:) selects the current directory on that drive.

The Path property can also be set to a qualified network path without a drive connection using the following syntax:

\\servername\sharename\path

The preceding syntax changes the Drive property to a zero-length string ("").

Changing the value of Path has these effects:

For a DirListBox control, generates a Change event.

For a FileListBox control, generates a PathChange event.

Note   For DirListBox, the return value of Path is different from that of List(ListIndex), which returns only the selection.


See Also

Archive, Hidden, Normal, System Properties

Change Event

Drive Property

FileName Property

List Property

ListCount Property

ListIndex Property (Control Array)

PathChange Event

Pattern Property

PatternChange Event

ReadOnly Property


Path Property Applies To

App Object

DirListBox Object

FileListBox Control


Zoom Property

Returns or sets the percentage by which printed output is to be scaled up or down.  Not available at design time.

Syntax

object.Zoom [= number]

The Zoom property syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

number	A numeric expression that evaluates to the percentage by which printed output is to be scaled.  The default is 0, which specifies that the printed page appears at its normal size.

Remarks

The Zoom property setting scales the size of the physical page up or down, by a factor of Zoom/100, to the apparent size of the printed output.  For example, a letter-size page printed with Zoom set to 50 contains as much data as a page of the size 17 by 22 inches because the printed text and graphics are scaled to one-half their original height and width.

Note   The effect of the properties of the Printer object depends on the driver supplied by the printer manufacturer.  Some property settings may have no effect, or several different property settings may all have the same effect.  Settings outside the accepted range may or may not produce an error.  For more information, see the manufacturer's documentation for the specific driver.


Font Property

Applies To

Returns a Font object.

Syntax

object.Font

The object placeholder represents an object expression that evaluates to an object in the Applies To list.

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


Font Property Applies To

CheckBox Control

ComboBox Control

CommandButton Control

DirListBox Control

DriveListBox Control

FileListBox Control

Form Object

Frame Control

Grid Control

Label Control

ListBox Control

OptionButton Control

PictureBox Control

TextBox Control


Container Property

See Also	Applies To

Returns or sets the container of a control on a Form.  Not available at design time.

Syntax

Set object.Container [= container]

The Container property syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

container	An object expression that evaluates to an object that can serve as a container for other controls, as described in Remarks.

Remarks

The following controls can contain other controls:

Frame control

PictureBox control.


See Also

Frame Control

Parent Property

PictureBox Control


Container Property Applies To

CheckBox Control

ComboBox Control

CommandButton Control

DIrListBox Control

DriveListBox Control

FileListBox Control

Frame Control

Grid Control

HScrollBar Control

Image Control

Label Control

Line Control

ListBox Control

OptionButton Control

PictureBox Control

Shape Control

TextBox Control

VScrollBar Control


Object Property

Applies To

Returns a reference to a property or method of a custom control which has the same name as a property or method automatically extended to the control by Visual Basic.

Syntax

object.Object[.property | .method] [= value]

The Object property syntax has these parts:

Part	Description

object	An object expression that evaluates to an object in the Applies To list.

property	Property of the custom control that is identical to the name of a Visual Basic-supplied property.

method	Method of the custom control that is identical to the name of a Visual Basic-supplied method.

value	Constant or value of the property or method.

Remarks

Visual Basic supplies some or all of a standard set of properties and methods to custom controls in a Visual Basic project.  It is possible for a custom control 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 custom 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 custom control.

For example, the Tag property is a property supplied to all custom controls in a Visual Basic project.  If a custom control in a project has the name ctlDemo, and you access the Tag property using this syntax:

ctlDemo.Tag

Visual Basic automatically uses the Tag property it supplies.  However, if the custom control defines its own Tag property and you want to access that property, you use the Object property in this syntax:

ctlDemo.Object.Tag

Visual Basic automatically extends some or all of the following properties and methods to custom controls in a Visual Basic project:

Properties
Align	DragIcon	LinkMode	TabIndex
Cancel	DragMode	LinkItem	TabStop
Container	Enabled	LinkTimeout	Tag
DataChanged	Height	LinkTopic	Top
DataField	HelpContextID	Name	Visible
DataSource	Index	Negotiate	WhatsThisHelpID
Default	Left	Parent	Width
Methods
Drag	LinkRequest	SetFocus
LinkExecute	LinkSend	ShowWhatsThis
LinkPoke	Move	ZOrder
If you use a property or method of a custom control and don't get the behavior you expect, check to see if the property or method has the same name as one of those shown in the preceding list.  If the names match, check the documentation provided with the custom control to see if the behavior matches the Visual Basic-supplied property or method.  If the behaviors aren't identical, you may need to use the Object property to access the feature of the custom control that you want.


Object Property Applies To

CommonDialog Control

Grid Control


Grid Control

See Also	Properties	Methods 	Events

A Grid control displays a series of rows and columns.  The intersection of a row and column is a cell.  You can read and set the contents of each cell in code.

Syntax

Grid

Remarks

You can put either text or a picture in any cell of a Grid.

The Row and Col properties specify the current cell in a Grid.  You can specify the current cell in code, or a 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 the text in a cell is too long to be displayed in the cell, the text wraps to the next line within the same cell.  To display the wrapped text, you must 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.  This control can't have more than 16352 rows and 5450 columns.

When a new element of a control array is loaded at run time, the new element doesn't inherit the original control's run-time properties.

Distribution Note   The Grid control is a custom control, which is a separate file with an .OCX extension.  To use the Grid control in your application, you must add the GRID16.OCX or GRID32.OCX file to the project.  To automatically include this custom control in new projects, add the file you need to AUTOLOAD.VBP.  When distributing your application, install the custom control file in the user's Microsoft Windows SYSTEM directory.  For more information on how to add a custom control to a project, see the Programmer's Guide.


See Also

Col Property

ColWidth Property

Row Property

RowHeight Property

Text Property


Grid Control Properties

BackColor Property

BorderStyle Property

CellSelected Property

Clip Property

Col Property

ColAlignment Property

ColIsVisible Property

Cols Property

ColWidth Property

Container Property

DragIcon Property

DragMode Property

Enabled Property

FillStyle Property

FixedAlignment Property

FixedCols Property

FixedRowsProperty

Font Property

FontBold Property

FontItalic Property

FontName Property

FontSize Property

FontStrikethru Property

FontUnderline Property

ForeColor Property

GridLines Property

GridLineWidth Property

Height Property

HelpContextID Property

HighLight Property

hWnd Property

Index Property

Left Property

LeftCol Property

MouseIcon Property

MousePointer Property

Name Property

Object Property

Parent Property

Picture Property

Row Property

RowHeight Property

Rows Property

ScrollBars Property

SelEndCol Property

SelEndRow Property

SelStartCol Property

SelStartRow Property

TabIndex Property

TabStop Property

Tag Property

Text Property

Top Property

TopRow Property

Visible Property

Width Property


Grid Control Methods

AddItem Method

Drag Method

Move Method

Refresh Method

RemoveItem Method

SetFocus Method

ZOrder Method


Grid Control Events

Click Event

DblClick Event

DragDrop Event

DragOver Event

GotFocus Event

KeyDown Event

KeyPress Event

KeyUp Event

LostFocus Event

MouseDown Event

MouseMove Event

MouseUp Event

RowColChange Event

SelChange Event