detecting carriage return in vb.net

Hello Experts
I am trying to check if the field is empty using the statement below

If (OT.DecMessage = "" Or OT.DecMessage Is Nothing )Then
    pnlOTDecMessagee.Visible = False
End if

But when I have a carriage return (blank lines) in the Message, its not returning True.

How can I include this in my condition please?

Thanks
S
LVL 8
newbie27Asked:
Who is Participating?
 
Hawkvalley1Connect With a Mentor Commented:
OrElse OT.DecMessage.Contains(Environment.Newline)
0
 
charlie324Connect With a Mentor Commented:
try
if Val(OT.DecMessage= Val(vbCrLf) then
' your statement
end if
0
 
ZhaolaiConnect With a Mentor Commented:
Try this:

if OT.DecMessage = vbCrLf then
    pnlOTDecMessagee.Visible = True
ElseIf (OT.DecMessage = "" OrElse OT.DecMessage Is Nothing )Then
    pnlOTDecMessagee.Visible = False
End if

0
 
newbie27Author Commented:
Hello Folks

Thanks for your input, for somereason only this statement works

OrElse OT.DecMessage.Contains(Environment.Newline)

Thanks Hawkvalley1
0
 
newbie27Author Commented:
Sorry folks, I have accidentally closed the question, I wanted to actually award points to above experts and closed.

Please can you revert back?

Thanks
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.