Solved

detecting carriage return in vb.net

Posted on 2010-09-17
5
381 Views
Last Modified: 2012-05-10
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
0
Comment
Question by:newbie27
5 Comments
 
LVL 6

Assisted Solution

by:charlie324
charlie324 earned 200 total points
ID: 33702373
try
if Val(OT.DecMessage= Val(vbCrLf) then
' your statement
end if
0
 
LVL 17

Assisted Solution

by:Zhaolai
Zhaolai earned 50 total points
ID: 33702389
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
 
LVL 9

Accepted Solution

by:
Hawkvalley1 earned 200 total points
ID: 33702451
OrElse OT.DecMessage.Contains(Environment.Newline)
0
 
LVL 8

Author Comment

by:newbie27
ID: 33703088
Hello Folks

Thanks for your input, for somereason only this statement works

OrElse OT.DecMessage.Contains(Environment.Newline)

Thanks Hawkvalley1
0
 
LVL 8

Author Comment

by:newbie27
ID: 33711194
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

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

896 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now