Comparison Between VB 6.0 and VB.NET Objects, Part 1

With this article, I want to provide a detailed explanation of the Form object's Property Window changes (from Visual Basic 6.0 to Visual Basic.NET). This will be very useful when you come from a Visual Basic 6 background. This article is not just aimed at VB6 veterans but to anyone starting with Visual Basic.NET—as you will see.

First off, start with the Visual Basic 6.0 Form property descriptions and settings.

Visual Basic 6 Properties Descriptions and their Settings

Have you ever wondered what all these properties do? I have found myself seeing a Form property in the Properties Window, and realising—I haven't used it before, or I don't know what exactly that particular Property does. So, what I've done was to compile this list of Visual Basic 6.0 Form object Properties along with Descriptions and Settings, which will be a handy reference to anyone using Visual Basic 6.

Property Name Property Description Property Setting
Appearance Returns/Sets whether or not an object is painted at run time with 3-D effects
  • 0 - Flat
  • 1 - 3D
AutoRedraw Returns the output from a graphics method to a persistent bitmap
  • True
  • False
BackColor Background color used to display text and graphics in an object

Choose any color from the appropriate tab in the Color dialog box

BorderStyle The Border style for an object Select any of the following:
  • 0 - None
  • 1 - Fixed Single
  • 2 - Sizable
  • 3 - Fixed Dialog
  • 4 - Fixed ToolWindow
  • 5 - Sizable ToolWindow
Caption Sets the text displayed in a window's title bar Textual data can be entered here
ClipControls Determines whether graphics methods in Paint events repaint an entire object
  • True
  • False
ControlBox Determines whether the Control's Menu Box is shown on the left side of the title bar
  • True
  • False
DrawMode Sets the appearance of output from graphics methods or of a Shape or a Line control Select any of the following:
  • 1 - Blackness
  • 2 - Not Merge Pen
  • 3 - Mask Not Pen
  • 4 - Not Copy Pen
  • 5 - Mask Pen Not
  • 6 - Invert
  • 7 - Xor Pen
  • 8 - Not Mask Pen
  • 9 - Mask Pen
  • 10 - Not Xor Pen
  • 11 - Nop
  • 12 - Merge Not Pen
  • 13 - Copy Pen
  • 14 - Merge Pen Not
  • 15 - Merge Pen
  • 16 - Whiteness
DrawStyle Determines the Line Style for output from graphics methods Select any of the following:
  • 0 - Solid
  • 1 - Dash
  • 2 - Dot
  • 3 - Dash-Dot
  • 4 - Dash-Dot-Dot
  • 5 - Transparent
  • 6 - Inside Solid
DrawWidth Line width for output from graphics methods Integer values ONLY
Enabled Determines whether a control can respond to user-generated events
  • True
  • False
FillColor Color used to fill in shapes, circles, and boxes

Choose any color from the appropriate tab in the Color dialog box

FillStyle Fill style of a shape Select any of the following:
  • 0 - Solid
  • 1 - Transparent
  • 2 - Horizontal Line
  • 3 - Vertical Line
  • 4 - Upward Diagonal
  • 5 - Downward Diagonal
  • 6 - Cross
  • 7 - Diagonal Cross
Font Returns a Font object

Choose desired Font from the displayed Dialogbox

ForeColor Forecolor used to display text and graphics in an object

Choose any color from the appropriate tab in the Color dialog box

HasDC Determines whether a unique display context is allocated for the control
  • True
  • False
Height Height of an object Integer Values ONLY
HelpContextID Specifies the default help file context ID of an object Integer values ONLY; for example: 0
Icon Icon displayed when a form is minimized at run time

Browse for desired Icon

KeyPreview Determines whether keyboard events for an object are invoked before keyboard events for controls on that object
  • True
  • False
Left Distance between the internal left edge of an object and the left edge of its container Integer values ONLY
LinkMode Type of link used for a DDE conversation and activates the connection
  • 0 - None
  • 1 - Manual
LinkTopic Source application and topic for a destination control Textual data
MaxButton Determines whether a form has a Maximize button
  • True
  • False
MDIChild Determines whether a form is displayed inside a MDI Parent form
  • True
  • False
MinButton Determines whether a form has a Minimize button
  • True
  • False
MouseIcon Sets a custom mouse icon

Browse for desired Icon

MousePointer Type of mouse pointer displayed when over part of an object Select any of the following:
  • 0 - Default
  • 1 - Arrow
  • 2 - Cross
  • 3 - I - Beam
  • 4 - Icon
  • 5 - Size
  • 6 - Size NE SW
  • 7 - Size N S
  • 8 - Size NW SE
  • 9 - Size W E
  • 10 - Up Arrow
  • 11 - Hourglass
  • 12 - No Drop
  • 13 - Arrow and Hourglass
  • 14 - Arrow and Question
  • 15 - Size All
  • 99 - Custom
Moveable Determines whether a form can be moved
  • True
  • False
Name Name of the form Textual data
NegotiateMenus Determines whether a form incorporates the menus from an object on the form's menu bar
  • True
  • False
OLEDropMode Determines whether this object can act as an OLE object
  • 0 - None
  • 1 - Manual
Palette Image that contains the palette to use on an object when PaletteMode is set to Custom

Browse for desired Palette

PaletteMode Value that determines which palette to use for controls on an object Select any of the following:
  • 0 - Halftone
  • 1 - UseZOrder
  • 2 - Custom
Picture Graphic to be displayed on the control

Browse for Picture to use on Form's Background

RightToLeft Text display direction and control visual appearance on a bidirectional system
  • True
  • False
ScaleHeight The number of units for the vertical measurement of a object's interior Any Numeric value
ScaleLeft Horizontal coordinates for the left edges of an object Any Numeric value
ScaleMode Value indicating measurement units for object coordinates when using graphics methods or positioning controls Select any of the following:
  • 0 - User
  • 1 - Twip
  • 2 - Point
  • 3 - Pixel
  • 4 - Character
  • 5 - Inch
  • 6 - Millimetre
  • 7 - Centimetre
ScaleTop Vertical coordinates for the top edges of an object Any Numeric value
ScaleWidth Number of units for the Horizontal measurement of an object's interior Any Numeric value
ShowInTaskbar Determines whether a form or MDIForm appears in the Windows taskbar.
  • True
  • False
StartUpPosition Value specifying the position of a form when it first appears Select any of the following:
  • 0 - Manual
  • 1 - CenterOwner
  • 2 - CenterScreen
  • 3 - Windows Default
Tag Stores any extra data needed for your program Any Textual and Numeric data
Top Distance between the internal top edge of an object and the top edge of its container Integer Values ONLY
Visible Determines whether the object is visible or hidden
  • True
  • False
WhatsThisButton Determines whether the What's This Button appears in the title bar of a form or MDI form
  • True
  • False
WhatsThisHelp Context-sensitive help uses the What's This popup provided by Windows Help
  • True
  • False
Width Width of an object Integer Values ONLY
WindowState Visual state of a form at run time Select any of the following:
  • 0 - Normal
  • 1 - Minimized
  • 2 - Maximized

Comparison Between VB 6.0 and VB.NET Objects, Part 1

Now that you have seen what exactly all the Visual Basic 6 Form properties do, look at the Visual Basic.NET Form properties. You will notice that some of the Visual Basic 6 Form properties have either changed or don't exist anymore. You will also notice a lot more new and exciting Visual Basic.NET form object properties. With the following list, I will describe each and every property thoroughly.

For a more detailed look at which Visual Basic 6.0 Form properties still exist or have changed, visit MSDN Control Property, Method, and Event Changes for Visual Basic 6.0 Users.

Visual Basic.NET Properties Descriptions and Settings

Property Name Property Description Property Setting
DataBindings Holds all the bindings of properties of this control to data sources Refer To the DataBindings Advanced property
DataBindings Advanced Allows you to bind properties of the control [VBNETDataBindingsAdv.jpg]

Use the above picture to assign binding properties to controls

Uses the DataBindings property to access the ControlBindingsCollection. By adding Binding objects to the collection, you can bind any property of a control to the property of an object.
Dynamic Properties Maps values in the application configuration file <appSettings> section to this component's properties [VBNETDynamicPropertiesAdv.jpg]

When a Box similar to the above picture is displayed, you can set Dynamic Properties for your controls

Dynamic Properties Advanced Advanced Dynamic properties allow you to configure and set key names by which to store any dynamic property values  
AcceptButton The accept button of the form. If this is set, the button is 'clicked' whenever the user presses the 'ENTER' key. Choose the button you want to select as a Default button from the displayed list
AccessibleDescription An object's AccessibleDescription property provides a textual description about an object's visual appearance. The description is primarily used to provide greater context for low-vision or blind users, but also can be used for context searching or other applications. Any Textual and Numeric data can be entered here. Textual is recommended.
AccessibleName The AccessibleName property is a label that briefly describes and identifies the object within its container, such as the text in a Button, the name of a MenuItem, or a label displayed next to a TextBox control. Any Textual and Numeric data can be entered here. Textual is recommended.
AccessibleRole The role of the object describes the function of the object and is used by accessibility applications [VBNETAccessibleRole.jpg]

Choose the applicable Role from the list

AllowDrop Determines whether the control will receive drag-drop notifications
  • True
  • False
AutoScale You can use this property to allow your form and its controls to automatically adjust based on changes in the font. This can be useful in applications where the font might increase or decrease based on the language specified for use by Windows.
  • True
  • False
AutoScroll If this property is set to True, scroll bars are displayed on the form if any controls are located outside the form's client region. Additionally, when autoscrolling is on, the client area of the form automatically scrolls to make the control with input focus visible.
  • True
  • False
AutoScrollMargin The margin around controls during auto scroll
The auto-scroll margin is the distance between any child controls and the edges of the scrollable parent control. The AutoScrollMargin size is added to the size of any child controls contained in the scrollable control to determine whether or not scroll bars are needed.
Integer data ONLY for Width and Height
AutoScrollMinSize The AutoScrollMinSize property is used to manage the screen size allocated to the automatic scroll bars. Integer data ONLY for Width and Height
BackColor The background color used to display text and graphics in the control [VBNETBackColorCustom.jpg][VBNETBackColorWeb.jpg]
[VBNETBackColorSystem.jpg]

You can select any color from any Tab in the Color Dialogbox

BackgroundImage The background image used for the control [VBNETBackgroundPicture.jpg]

Browse for a picture on your system using the above Dialog box

CancelButton This property allows you to designate a default action to occur when the user presses the 'ESC' key in your application. You can use this property to allow the user to quickly navigate a simple form by allowing them to simply press the 'ESC' key to close a window without committing changes instead of manually clicking the Cancel button with their mouse. Choose the button you wish to select as a Default button from the displayed list
CausesValidation Gets or sets a value indicating whether the control causes validation to be performed on any controls that require validation when it receives focus.
  • True
  • False
ContextMenu The shortcut menu to display when the user right-clicks the control Choose any ContextMenu item (on the Form) from the list
ControlBox If the ControlBox property is set to true, the control box is displayed in the upper-left corner of the caption bar. The control box is where the user can click to access the system menu.
  • True
  • False
Cursor The cursor that appears when the mouse pointer passes over the control [VBNETCursor.jpg]

Based on your needs, select the appropriate Cursor from the list

DockPadding This determines the size of the border for docked controls Integer data ONLY for:
  • All - Number of pixels along all borders to pad docked controls
  • Left - Number of pixels along the left to pad docked controls
  • Top - Number of pixels along the top to pad docked controls
  • Right - Number of pixels along the right to pad docked controls
  • Bottom - Number of pixels along the right to pad docked controls
Enabled Gets or sets a value indicating whether the control can respond to user interaction
  • True
  • False
Font The font used to display text in the control [VB6FontSelectionDialogBox.jpg]

Name [VBNETFontName.jpg]

  • Size - Any Numeric value
  • Unit - World, Pixel, Point, Inch, Document, Millimetre
  • Bold - True, False
  • GdiCharSet - Integer values ONLY
  • GdiVerticalFont - True, False
  • Italic - True, False
  • Strikeout - True, False
  • Underline - True, False
ForeColor The foreground color used to display text and graphics in the control [VBNETBackColorCustom.jpg][VBNETBackColorWeb.jpg]
[VBNETBackColorSystem.jpg]

You can select any color from any Tab in the Color dialog box

FormBorderStyle Controls the appearance of the border for the form. This also will affect how the caption bar is displayed and what buttons are allowed to appear on it.
Fixed3D A fixed, three-dimensional border.
FixedDialog A thick, fixed dialog-style border.
FixedSingle A fixed, single-line border.
FixedToolWindow A tool window border that is not resizable. A tool window does not appear in the taskbar or in the window that appears when the user presses 'ALT+TAB'.
None No border.
Sizable A resizable border.
SizableToolWindow A resizable tool window border. A tool window does not appear in the taskbar or in the window that appears when the user presses 'ALT+TAB'.
GridSize Determines the size of the positioning grid Integer Values ONLY
HelpButton When this property is set to true, a small button with a question mark appears in the caption bar to the left of the Close button. You can use this button to display help for your application. You can create an event handler for the HelpRequested event of the Control class to display Help information to the user when the Help button of the form is clicked.
  • True
  • False
Icon A form's icon designates the picture that represents the form in the taskbar as well as the icon that is displayed for the control box of the form. [VBNETIcon.jpg]

Unless an icon is selected, the Size sub-properties will be un-editable.

ImeMode Determines the IME (Input Method Editor) status of the object when selected

An input method editor (IME) is a program that allows users to enter complex characters and symbols, such as Japanese Kanji characters, using a standard keyboard. The ImeMode property is typically set to ImeMode.Off for a TextBox control that is intended to only enter numeric values. The ImeMode property value is set to ImeMode.NoControl for the Form class.

Select any of the following:
  • Inherit
  • NoControl
  • On
  • Off
  • Disable
  • Hiragana
  • Katakana
  • KatakanaHalf
  • AlphaFull
  • Alpha
  • HangulFull
  • Hangul
IsMdiContainer This property changes the display and behavior of the form to an MDI parent form. When this property is set to true, the form displays a sunken client area with a raised border. All MDI child forms assigned to the parent form are displayed within its client area.
  • True
  • False
KeyPreview When this property is set to true, the form will receive all KeyPress, KeyDown, and KeyUp events. After the form's event handlers have completed processing the keystroke, the keystroke is then assigned to the control with focus.

You can use this property to process all keystrokes in your application and either handle the keystroke or call the appropriate control to handle the keystroke. For example, when an application uses function keys, you might want to process the keystrokes at the form level rather than writing code for each control that might receive keystroke events.

Note: If a form has no visible or enabled controls, it automatically receives all keyboard events.

  • True
  • False
Language Indicates the current localizable language List of languages from which to choose
Location The position of the top-left corner of the control with respect to its container Integer values for X and Y
Locked The Locked property determines whether you can move or resize the control
  • True
  • False
MaximizeBox Determines whether a form has a maximize box in the upper-right corner of its caption bar
  • True
  • False
MaximumSize The maximum size the form can be resized to.

This property enables you to limit the size of a form to a specified maximum size. You can use this feature when displaying multiple windows at the same time, to ensure that a single window does not cause other windows to be hidden. If this property is set to a Size object that is 0 in height and 0 in width, the form will have no maximum size beyond the limits set by Windows.

Integer values for Width and Height
Menu You can use this property to switch between complete menu sets at run time. For example, you can define one MainMenu to be displayed when your multiple document interface (MDI) form has no active MDI child forms and another MainMenu to display when a child window is displayed. You can also use a different MainMenu when specific conditions exist in your application that require displaying a different menu set. Choose from a list of Main Menu controls on the form
MinimizeBox Determines whether a form has a minimize box in the upper-right corner of its caption bar
  • True
  • False
MinimumSize The minimum size the form can be resized to.

This property enables you to limit the size of a form to a specified minimum size. You can use this feature to prevent a user from sizing a window to an undesirable size. If this property is set to a Size object that is 0 in height and 0 in width, the form will have no minimum size beyond the limits set by Windows.

Integer values for: Width and Height
Name Gets or sets the name of the control. Textual data
Opacity This property enables you to specify a level of transparency for the form and its controls. This property differs from transparency provided by the TransparencyKey, which only makes a form and its controls completely transparent if they are the same color as the value specified in the TransparencyKey property. When this property is set to a value less than 100% (1.00), the entire form, including borders, is made more transparent. Setting this property to a value of 0% (0.00) makes the form completely invisible. You can use this property to provide different levels of transparency or to provide effects such as phasing a form in or out of view. For example, you can phase a form into view by setting the Opacity property to a value of 0% (0.00) and gradually increasing the value until it reaches 100% (1.00). Percentage values Ranging from (0% to 100%)
RightToLeft The RightToLeft property is used for international applications where the language is written from right to left, such as Hebrew or Arabic. When this property is set to RightToLeft.Yes, control elements that include text are displayed from right to left.

If the control is a top-level control, the user's operating system is queried to determine whether the control needs to enable right-to-left support.

The following are a few examples of how control elements are affected by the RightToLeft property value of RightToLeft.Yes:

  • Vertical scroll bars are displayed on the left side rather than right side of scrollable controls.
  • Horizontal scroll bars start with the scroll box (thumb) right-aligned.
  • The check box element alignment, controlled by the CheckAlign property, is reversed for CheckBox and RadioButton controls.
  • Text displayed in the title bar of a Form is right-aligned. The icon and control box retain their left and right alignment respectively.
  • Items in list box, combo box, and up-down controls are right aligned.
  • Menus are displayed right-aligned.
  • The alignment of toolbar buttons on a ToolBar control or the alignment of text on a ToolBarButton is not affected by the RightToLeft property.
  • No
  • Yes
  • Inherit
ShowInTaskbar You can use this property to prevent users from selecting your form through the Windows taskbar.
  • True
  • False
Size This property allows you to set both the height and width of the form at the same time instead of setting the Height and Width properties individually. Integer values for Width and Height
SizeGripStyle This property enables you to determine when the sizing grip is displayed on the form. You can set this property to display the sizing grip or have it automatically displayed based on the setting of the FormBorderStyle property.
  • Auto
  • Show
  • Hide
SnapToGrid Determines whether controls should snap to the positioning grid
  • True
  • False
StartPosition This property enables you to set the starting position of the form when it is displayed at run time. The form can be displayed manually or in the default location specified by Windows. Select any of the following:
  • Manual
  • CenterScreen
  • WindowsDefaultLocation
  • WindowsDefaultBounds
  • CenterParent
Tag A common use for the Tag property is to store data that is closely associated with the control. For example, if you have a control that displays information about a customer you, might store a DataSet that contains the customer's order history in that control's Tag property so the data can be accessed quickly. Any type derived from the Object class can be assigned to this property. If the Tag property is set through the Windows Forms designer, only text can be assigned.
Text Gets or sets the text associated with this control. Textual data and any Numeric data can be entered here.
TopMost A top-most form is a form that overlaps all the other forms even if it is not the active or foreground form.
  • True
  • False
TransparencyKey When the TransparencyKey property is assigned a Color, the areas of the form that have the same BackColor will be displayed transparently. Any mouse actions, such as the click of the mouse, that are performed on the transparent areas of the form will be transferred to the windows below the transparent area. [VBNETBackColorCustom.jpg][VBNETBackColorWeb.jpg]
[VBNETBackColorSystem.jpg]

You can select any color from any Tab in the Color dialog box.

WindowState Determines the initial visual state of the form Select any of the following:
  • Normal
  • Minimized
  • Maximized

I hope this has made your migration to Visual Basic.NET a tiny bit easier, and that I have given you enough insight to the Form object Properties Window changes. Watch for Part II (Changes in the Toolboxes) of Comparison Between VB 6.0 and VB.NET Objects.



About the Author

Hannes du Preez

Hannes du Preez is a Microsoft MVP for Visual Basic. He is a trainer at a South African-based company. He is the co-founder of hmsmp.co.za, a community for South African developers.

Comments

  • There are no comments yet. Be the first to comment!

Leave a Comment
  • Your email address will not be published. All fields are required.

Top White Papers and Webcasts

  • QA teams don't have time to test everything yet they can't afford to ship buggy code. Learn how Coverity can help organizations shrink their testing cycles and reduce regression risk by focusing their manual and automated testing based on the impact of change.

  • Live Event Date: October 29, 2014 @ 11:00 a.m. ET / 8:00 a.m. PT Are you interested in building a cognitive application using the power of IBM Watson? Need a platform that provides speed and ease for rapidly deploying this application? Join Chris Madison, Watson Solution Architect, as he walks through the process of building a Watson powered application on IBM Bluemix. Chris will talk about the new Watson Services just released on IBM bluemix, but more importantly he will do a step by step cognitive …

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds