Solved

detecting carriage return in vb.net

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

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
encoding an href string 2 21
Deploying to Azure 3 29
Modal Popup Extender control 1 22
Calculate number of nights between two dates 5 28
A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

821 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