Udostępnij za pośrednictwem


MaskEdBox Control for Visual Basic 6.0 Users

The MaskEdBox control in Visual Basic 6.0 is replaced by the Windows Forms MaskedTextBox control in Visual Basic 2008. The names of some properties, methods, events, and constants are different, and in some cases there are differences in behavior.

Conceptual Differences

In Visual Basic 6.0, the AutoTab property determines whether the next control in the TAB order receives focus as soon as the Text property of a MaskEdBox control is filled with valid data.

In Visual Basic 2008, there is no equivalent for the AutoTab property. You can achieve the same effect by monitoring and validating the input, and setting the focus to the next control yourself.

In Visual Basic 6.0, the PasswordChar property is of type String; in Visual Basic 2008 it is of type Char.

In addition, there are numerous conceptual differences that apply to all controls, including differences in data binding, font handling, drag-and-drop, Help support and more. For more information, see Windows Forms Concepts for Visual Basic 6.0 Users.

MaskedEdBox Control Property, Method, and Event Equivalencies

The following tables list Visual Basic 6.0 properties, methods, and events, along with their Visual Basic 2008 equivalents. Those properties, methods, and events that have the same name and behavior are not listed. All Visual Basic 2008 enumerations map to the System.Windows.Forms namespace unless otherwise noted.

This table provides links to topics explaining behavior differences. Where there is no direct equivalent in Visual Basic 2008, links are provided to topics that present alternatives.

Properties

Visual Basic 6.0

Visual Basic 2008 Equivalent

AllowPrompt

AllowPromptAsInput

Appearance

New implementation. For more information, see Appearance and BorderStyle Properties for Visual Basic 6.0 Users.

AutoTab

New implementation.

BackColor

BackColor

NoteNote:
Colors are handled differently in Visual Basic 2008. For more information, see Color Handling for Visual Basic 6.0 Users.

ClipMode

SkipLiterals

ClipText

Text

NoteNote:
The Visual Basic 6.0 ClipText property excludes literals; in Visual Basic 2008 literals are included unless SkipLiterals is set to true.

Container

Parent

DataBinding

DataChanged

DataField

DataFormat

New implementation. For more information, see Data Access for Visual Basic 6.0 Users.

DragIcon

DragMode

New implementation. For more information, see Drag and Drop for Visual Basic 6.0 Users.

Font

FontBold

FontItalic

FontName

FontSize

FontStrikethrough

FontUnderline

Font

NoteNote:
Fonts are handled differently in Visual Basic 2008. For more information, see Font Object for Visual Basic 6.0 Users.

ForeColor

ForeColor

NoteNote:
Colors are handled differently in Visual Basic 2008. For more information, see Color Handling for Visual Basic 6.0 Users.

Format

New implementation. Use formatting functions such as FormatNumber Function (Visual Basic) or FormatDateTime Function (Visual Basic).

FormattedText

Text

NoteNote:
The Visual Basic 6.0 ClipText property excludes literals; in Visual Basic 2008 literals are included unless SkipLiterals is set to true.

Height

Height, Size

NoteNote:
Coordinates are handled differently in Visual Basic 2008. For more information, see Coordinate System for Visual Basic 6.0 Users.

HelpContextID

New implementation. For more information, see Help Support for Visual Basic 6.0 Users.

HWnd

Handle

Index

New implementation. For more information, see Control Arrays for Visual Basic 6.0 Users.

Left

Left

NoteNote:
Coordinates are handled differently in Visual Basic 2008. For more information, see Coordinate System for Visual Basic 6.0 Users.

MouseIcon

New implementation. For more information, see Cannot set a custom MousePointer.

MousePointer

Cursor

For a list of constants, see MousePointer for Visual Basic 6.0 Users.

OLEDragMode

OLEDropMode

New implementation. For more information, see Drag and Drop for Visual Basic 6.0 Users.

Parent

FindForm method

PromptInclude

TextMaskFormat

SelLength

SelectionLength

SelStart

SelectionStart

SelText

SelectedText

ToolTipText

ToolTip component.

For more information, see ToolTip Support for Visual Basic 6.0 Users.

Top

Top

NoteNote:
Coordinates are handled differently in Visual Basic 2008. For more information, see Coordinate System for Visual Basic 6.0 Users.

WhatsThisHelpID

New implementation. For more information, see Help Support for Visual Basic 6.0 Users.

Width

Width, Size

NoteNote:
Coordinates are handled differently in Visual Basic 2008. For more information, see Coordinate System for Visual Basic 6.0 Users.

Methods

Visual Basic 6.0

Visual Basic 2008 Equivalent

Drag

New implementation. For more information, see Drag and Drop for Visual Basic 6.0 Users.

Move

SetBounds

NoteNote:
Coordinates are handled differently in Visual Basic 2008. For more information, see Color Handling for Visual Basic 6.0 Users.

OLEDrag

New implementation. For more information, see Drag and Drop for Visual Basic 6.0 Users.

SetFocus

Focus

ShowWhatsThis

New implementation. For more information, see Help Support for Visual Basic 6.0 Users.

ZOrder

BringToFront or SendToBack function

Events

Visual Basic 6.0

Visual Basic 2008 Equivalent

Change

TextChanged

DblClick

DoubleClick

DragDrop

DragOver

New implementation. For more information, see Drag and Drop for Visual Basic 6.0 Users.

GotFocus

Enter

LostFocus

Leave

OLECompleteDrag

OLEDragDrop

OLEDragOver

OLEGiveFeedback

OLESetData

OLEStartDrag

New implementation. For more information, see Drag and Drop for Visual Basic 6.0 Users.

Validate

Validating

ValidationError

MaskInputRejected

Upgrade Notes

When a Visual Basic 6.0 application is upgraded to Visual Basic 2008, any MaskEdBox controls are upgraded to Windows Forms MaskedTextBox controls, and properties, methods and events are upgraded to their equivalents. Where there may be differences in behavior, upgrade comments are inserted into the code.

See Also

Tasks

Walkthrough: Working with the MaskedTextBox Control

MaskedTextBox Control Sample

How to: Bind Data to the MaskedTextBox Control

Other Resources

MaskedTextBox Control (Windows Forms)