Greetings community.
I am Converting an application from Option Strict off to ON and came across two problems i cannot seem to figure out. Actualy i solved one but i think its a less than optimal fix so im looking for advice on the Ctype question a bit further down.
I am receiving an error in an If statment.
Debug Error: Option strict On disallows operands of type object for operator "=". Use the IS operator to test for object identity.Code:If cboClass.SelectedValue = 1 Then getBigBrother() End If
I rewrote the code attemting to use the IS accordingly.
Debug error: IS requires operands that have refrence types, but this operand has value type Integer.Code:Dim compval As Boolean = False Dim num As Integer = 1 compval = cboClass.SelectedValue Is num If compval = True Then getBigBrother() End If
SO theres my primary problem, Any advice would be apreciated..
Now my second question
I had code in my app writen like this:
It works fine with Strict OFF, now with Strict ON i had to modify as follows.Code:Dim userIdValG as String userIdValG = cboUserName.SelectedValue
Is that the most efficient way to cast that object to a String.???Code:Dim userIdValG as String userIdValG = Cstr(cboUserName.SelectedValue)




Reply With Quote