VB6 Button.Value = true/false - how to do this in VB.NET
-
Hi, I dont see any value property for button. When I convert VB6 application to VB.net, the code as follows VB 6.0 Public Property Get VarArray(ByVal ctrl As Control) As String VarArray = ctrl.Value End Property After converting to VB.NET Public ReadOnly Property VarArray(ByVal ctrl As System.Windows.Forms.Control) As String Get 'UPGRADE_WARNING: Couldn't resolve default property of object ctrl.Value. Click for more: 'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"' VarArray = ctrl.Value End Get End Property Here VB.NET code is giving compilation error "Value is not member of 'System.Windows.Forms.Control'" Please let me know how to do this. Thanks in Advance,
AR Reddy
-
Hi, I dont see any value property for button. When I convert VB6 application to VB.net, the code as follows VB 6.0 Public Property Get VarArray(ByVal ctrl As Control) As String VarArray = ctrl.Value End Property After converting to VB.NET Public ReadOnly Property VarArray(ByVal ctrl As System.Windows.Forms.Control) As String Get 'UPGRADE_WARNING: Couldn't resolve default property of object ctrl.Value. Click for more: 'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"' VarArray = ctrl.Value End Get End Property Here VB.NET code is giving compilation error "Value is not member of 'System.Windows.Forms.Control'" Please let me know how to do this. Thanks in Advance,
AR Reddy
You could consider going through the trouble of inheriting System.Windows.Forms.Button to create your own button control that has a Value property, but that process, although not particularly difficult, may still not be necessary. Maybe you can simply manipulate the button's Tag property in .Net to emulate how you were using the Value property?
-
Hi, I dont see any value property for button. When I convert VB6 application to VB.net, the code as follows VB 6.0 Public Property Get VarArray(ByVal ctrl As Control) As String VarArray = ctrl.Value End Property After converting to VB.NET Public ReadOnly Property VarArray(ByVal ctrl As System.Windows.Forms.Control) As String Get 'UPGRADE_WARNING: Couldn't resolve default property of object ctrl.Value. Click for more: 'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"' VarArray = ctrl.Value End Get End Property Here VB.NET code is giving compilation error "Value is not member of 'System.Windows.Forms.Control'" Please let me know how to do this. Thanks in Advance,
AR Reddy
A couple things: First, the property
Value
on a CommandButton in VB6 is a Boolean - not a string. Secondly, In all of VB6's infinite wisdom, doingCall Command1_Click()
has the same effect of settingCommand1.Value=True
in code. So, the only timeVarArray
in your VB6 code above would be true is whenCommand1_Click()
is called. :sigh: If you are using RadioButtons or CheckBoxes,Value
was replaced byChecked
.