The five Errors are all "Design Error (Layout)" errors in the Form. Each of them relates to a Form property in VB 6 that is simply not supported at all, or supported a different way in VB .NET. Two (ClipControls and PaletteMode) are now done with GDI+ programming. Something that has changed even more than VB .NET (if such a thing is possible). One (LinkMode) provides for an interesting use of DDE in the old VB 6 version. The .NET upgrade documentation makes it very clear that DDE has well and truely been dropped now:
"Some legacy features such as Dynamic Data Exchange are no longer supported; consequently any code that sets DDE-related properties or methods would cause compilation errors in Visual Basic .NET"
Another error tells you that System fonts aren't supported in VB .NET and the final one tells you that "What's This" style Help is now done a different way, "
"In Visual Basic .NET, pop-up Help is implemented using the HelpButton property of a form."
The warnings are even less of a problem, but they might be confusing. All of them are variables where VB 6 might have intended a late bound object, but really intended a simple Variant type variable. The error message could be confusing. Here's a sample:
Runtime Warning Cancel_Click Couldn't resolve default property of object Op1.
Digging deeper, Microsoft provides this explanation:
In Visual Basic 6.0, objects had a default property that could be used as a shortcut in code. For example, the default property of a TextBox control was the Text property; you could type TextBox1 = "Hello" instead of TextBox1.Text = "Hello".
In Visual Basic .NET, default properties are no longer supported; all property references must be fully qualified. During upgrade, default properties for early-bound objects are resolved to the property name; however, late-bound objects cannot be resolved because it is impossible to determine a default property without knowing what the object is.
In addition, Visual Basic 6.0 allowed late-bound calls to implemented interfaces of classes; this is no longer allowed in Visual Basic .NET.
The following example shows late-bound code that cannot be resolved:
' Visual Basic 6.0
Dim x As String
Dim y As Object
x = "Hello"
Set y = Form1.Controls(0)
y = x
Debug.Print y
In this example, y -- a late-bound object that is not resolved until run time -- takes on the default property of Form1.Controls(0). Your coding style might be different, but this looks obscure to me. I don't personally recall coding this type of object very often in VB 6.
But Microsoft is known for using obscure, difficult code in their examples sometimes. When I checked the VB .NET code created by the Upgrade Wizard, I initially suspected that this might be one of those times since the problem object, Op1, is declared as a pure object rather than a specific type.
Dim Op1, Op2 As Object
When you check the original VB 6 code, you find it was all a false alarm. Here's the declaration there:
Dim Op1, Op2
It's just a simple Variant. But the Upgrade Wizard didn't know that. It could have been a late-bound object and the Wizard took the most conservative choice.
One of the reasons I decided to go through the whole explanation of something that ultimately turned out to be quite simple was to make the point that most of the things you will deal with do turn out that way. In general, the conversions done by the Wizard work pretty well, even if it's not always clear why they work.
With the generated errors taken care of -- actually just ignored -- let's see how the Upgrade Wizard handled the Control Arrays that are simply not supported in VB .NET.
Next page >
Converting a Control Array: The Wizard Way > Page
1,
2,
3,
4