Export (0) Print
Expand All
Expand Minimize
This topic has not yet been rated - Rate this topic

Value for a property could not be resolved

Visual Studio .NET 2003

During upgrade, some Visual Basic 6.0 properties are mapped to Visual Basic .NET properties with different values. In these cases, properties that are resolved at run time by evaluating a variable or function return cannot be resolved by the upgrade tool.

For example, the AutoSize property of a PictureBox control is upgraded to the SizeMode property of the Windows Forms PictureBox control. If the property was set to true or false (or their numeric equivalents) in the original code, it will be mapped to System.Windows.Forms.PictureBoxSizeMode.AutoSize (for true) or System.Windows.Forms.PictureBoxSizeMode.Normal (for false). If the property was set to the value of a variable or function return, the value is not known and cannot be properly upgraded.

' Visual Basic 6.0
Dim x As Boolean
x = False
Picture1.AutoSize = True
Picture2.AutoSize = False
Picture3.AutoSize = x
' MyAutoSize is a function that returns either True or False.
Picture4.AutoSize = MyAutoSize ()

' After upgrade to Visual Basic .NET
Dim x As Boolean
x = False
Picture1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize
Picture2.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Normal
' x cannot be resolved.
Picture3.SizeMode = x
' MyAutoSize () cannot be resolved.
Picture4.SizeMode = MyAutoSize ()

What to do next

  • If the property value was stored in a variable, change the value (and type if necessary) of the variable where it is set.
    ' Modified VisualBasic .NET code
    Dim x As String
    x = " System.Windows.Forms.PictureBoxSizeMode.Normal"
    Picture3.SizeMode = x
    
    Note   Before modifying the variable, search your code to make sure it is not referenced elsewhere. If the variable is shared, you may need to create a new variable rather than modifying the existing variable.
  • If the property value was the return value of a function, modify the function to return the correct value.
    ' Visual Basic 6.0 
    Public Function MyAutoSize () As Boolean
        MyAutoSize = True
    End Function
    
    ' Modified Visual Basic .NET code
    Public Function MyAutoSize () As System.Windows.Forms.PictureBoxSizeMode
       MyAutoSize = System.Windows.Forms.PictureBoxSizeMode.AutoSize
    End Function
    

See Also

Control Changes in Visual Basic .NET

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.