I'm doing some string manipulation in VB.NET. In previous versions of VB, if you wanted to covert something to String you would use the CStr(or ToString, if available). Now in .NET, since everything is more object based, you can use the ToString everywhere.
Not so fast my friends.....
The catch is if what you're manipulating is null /or nothing. Where you'll receive errors, if you try and use any of the string instance methods. Obviously the solution is to do an Is Nothing check on what you're manipulation. Where the CStr and all it's old VB6 cowarts(CBool, CDate, CInt, etc.) don't care.
I'm trying to get away from using on VB6 stuff(especially since Microsoft has taken other stuff from VB6 and not included it all), and use what VB.NET provides. It just seems like a step backward having to do an Is Nothing check anytime I want to convert data types.
If anyone has found some ways around this /or information on this, please share.
Thanks.
Not so fast my friends.....
The catch is if what you're manipulating is null /or nothing. Where you'll receive errors, if you try and use any of the string instance methods. Obviously the solution is to do an Is Nothing check on what you're manipulation. Where the CStr and all it's old VB6 cowarts(CBool, CDate, CInt, etc.) don't care.
I'm trying to get away from using on VB6 stuff(especially since Microsoft has taken other stuff from VB6 and not included it all), and use what VB.NET provides. It just seems like a step backward having to do an Is Nothing check anytime I want to convert data types.
If anyone has found some ways around this /or information on this, please share.
Thanks.