I have a class X with a property called NumericEntry. The property is of the object type since I don't know what type of value will be put in it. The property default is Nothing. It could be an integer or single. I have an issue when trying to store an integer or a single (whose value is 0) into the property. It remains Nothing. If I pass any other value as integer or single, it works fine.
Code:Public Class X Public Property NumericEntry as Object = Nothing End Class Public Sub StoreValue(Mode as Integer, Value as String) Select Case Mode case 1 ' integer Dim intValue as Integer = 0 ' intValue = CType(Math.Truncate(Val(Value)), Integer) x.NumericEntry = intValue case 2 ' single Dim sngValue as Single = 0 ' sngValue = CType(Val(Value), Single) x.NumericEntry = sngValue End select End Sub




Reply With Quote
