{String1 = Nothing or "Blahblah"} ... String1 should = "Blahblah" not exception?
Hi everyone, I'm brand new here, sorry about the title but it was the best way I could summarise my problem.
My code scenario is this:
Now this code returns a null reference exception. What I want is a way to get String1 to get the value of PotentialNullString but if that happens to be Nothing then it should be "This is an Empty String".
I know this is quite easily doable by checking If PotentialNullString IsNot Nothing first but I want to do it all on one line, one expression.
Is this possible?
Hi everyone, I'm brand new here, sorry about the title but it was the best way I could summarise my problem.
My code scenario is this:
VB.NET:
Dim String1 as String
Dim PotentialNullString as String = Nothing
String1 = PotentialNullString Or "This is an Empty String"
Now this code returns a null reference exception. What I want is a way to get String1 to get the value of PotentialNullString but if that happens to be Nothing then it should be "This is an Empty String".
I know this is quite easily doable by checking If PotentialNullString IsNot Nothing first but I want to do it all on one line, one expression.
Is this possible?