Solved

detecting carriage return in vb.net

Posted on 2010-09-17
5
385 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
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.…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

828 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