VB6 user controls expose their programmer-defined properties in the property list on the designer window.
These user properties can be configured to be displayed in a specific category and based on these settings, the Visual Basic Upgrade Companion can determine the most appropriate type and settings for the resulting properties to have functional equivalence with the original VB6 user property.
Public Property Let Nombre(S As String) Attribute Prop1.VB_Description = "Sample user property" Attribute Prop1.VB_HelpID = 23 Attribute Prop1.VB_ProcData.VB_Invoke_PropertyPut = ";Text" Attribute Prop1.VB_MemberFlags = "200" pProp1 = S End Property Public Property Get Prop1() As String Prop1 = pProp1 End Property
VBUC will analyze these attributes to guarantee the resulting properties will have an equivalent behavior. The most important attribute on the resulting .NET properties is the System.Component.Browsable(true). This will make Visual Studio IDE to show the property in the property list when in design mode.
The “browsable” attribute can be included into the designer code for 3 main reasons: if the design-time attributes contain the “VB_Description” attribute, if the “VB_ProcData” is present, and if the “VB_MemberFlags” attribute is present with a value of 40 or 400. For this particular case, the “browsable” attribute must be set to false.
The “VB_ProcData” normally contains two parameters separated by a semi-colon. These parameters represent the pop-out editor to set the property value (color choose dialog, font choose dialog and others).
Original VB6 Dialog Box | .NET target component |
Appearance, Font | System.ComponentModel.Category.Appearance |
Behavior | System.ComponentModel.Category.Behavior |
Data | System.ComponentModel.Category.Data |
DDE, List, Misc, Text | System.ComponentModel.Category.Default |
Position, Scale | System.ComponentModel.Category.Layout |
VBUC upgrades the “InitProperties” event as a user method in order to be called from the “InitializeComponents” method of the user control in .NET.
The “Show” event is upgraded as a method that implements the “Load” event in .NET.
Protected Sub UserControl_Show(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load 'Code End Sub
The “Paint” event is upgraded as a method that implements the “Paint” event in .NET
Private Sub UserControl1_Paint(ByVal eventSender As Object, ByVal eventArgs As PaintEventArgs) Handles MyBase.Paint 'Code End Sub
VBUC upgrades the “Initialize” event as a user method in order to be called from the “InitializeComponents” method of the user control in .NET.
The “Terminate” event is upgraded as a user method in order to be called from the Dispose implementation of the user control.
The “Load” event is upgraded as a method that implements the “Load” event in .NET.
This method is no longer necessary after upgrading to .NET
This method is no longer necessary after upgrading to .NET
9130 Jollyville Rd, Suite 175
Austin, TX 78759
Call us: +1 (425) 609-8458
info@wearegap.com