lundi 11 mai 2015

VB .NET comparing strings

I don't get what's going on. The method equals doesn't work, and neither comparing the strings with the '=' operator or with 'string.compare'. thetruth is always set as "false".

Public Function ProcessLabel(myValue As Object) As String
    If ((myValue Is DBNull.Value) = False) Then
        Dim thetruth As Boolean
        Dim myValueStr As String
        myValueStr = CStr(myValue)
        thetruth = String.Equals(myValueStr, "01/01/1900")
    End If
    Return myValue.ToString
End Function

I cannot attach images but I assure you, in myValueStr I have "01/01/1900".

Aucun commentaire:

Enregistrer un commentaire