G
Guest
I need to know what the appropriate way to test for nothing in several different types of data types is. Here are some examples
For string I use this
If Not abc.text Is Nothing AndAlso Not abc.text = "" The
' Some Cod
End I
For datetime's I'm currently using something like this
If Not abc.ToShortDateString = "01/01/0001" The
' Some Cod
End I
For Integers, I use this
If not abc = 0 The
' Some Cod
End I
For object, I'm asuming that it'd be against nothing like this
If Not abc Is Nothing The
' Some Cod
End I
What about other data types? I know Boolean wouldn't matter, because when it's not initialized, it's False. What about things like Decimal, Single, Double, Long, Byte, Char, etc.? Also, are the ways I'm testing above the correct way to test?
For string I use this
If Not abc.text Is Nothing AndAlso Not abc.text = "" The
' Some Cod
End I
For datetime's I'm currently using something like this
If Not abc.ToShortDateString = "01/01/0001" The
' Some Cod
End I
For Integers, I use this
If not abc = 0 The
' Some Cod
End I
For object, I'm asuming that it'd be against nothing like this
If Not abc Is Nothing The
' Some Cod
End I
What about other data types? I know Boolean wouldn't matter, because when it's not initialized, it's False. What about things like Decimal, Single, Double, Long, Byte, Char, etc.? Also, are the ways I'm testing above the correct way to test?