Click here to Skip to main content
12,828,639 members (44,689 online)
Rate this:
Please Sign up or sign in to vote.
See more: C#
I want to check Null value in textbox field,if it 's Null,then print something.I tried Is Nothing but still getting the #ERROR display.

=IIF(Fields!NonTechHours.Value is Nothing,"Null",IIF(Right(Fields!NonTechHours.Value,InStr(Fields!NonTechHours.Value,"."))>0,Fields!NonTechHours.Value,Left(Fields!NonTechHours.Value,InStr(Fields!NonTechHours.Value,".")-1)))
Posted 15-Feb-11 19:08pm
Sandeep Mewara 16-Feb-11 5:56am
I see you do a repost, why so? Please avoid it in future!
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

If you are using .Net 2.0 or above, you can actually use the null coalesce operator - ??.

This will convert null into "" automatically.
Your code will be something like Fields!NonTechHours.Value?? "".
Rajni from delhi 16-Feb-11 0:27am
?? operator is not in RDLC
Abhinav S 16-Feb-11 0:56am
I thought you were writing this line in code as your question tag said C#.
SAKryukov 16-Feb-11 0:56am
What your tag C# means? It is applicable? If not, remove it, don't confuse people!
SAKryukov 16-Feb-11 0:57am
I voted 5 before I was this note -- won't hurt I hope :-)
Rajni from delhi 16-Feb-11 1:09am
sorry,Act. m new to this code Project site.wht's tag should i use for it?how can i achieve the solution of my problem?
Abhinav S 16-Feb-11 1:35am
No it wont hurt at all. :)
Abhinav S 16-Feb-11 1:35am
You can use a tag that like RDLC or 'report'. This will help others understand your question quicker, besides making sure that people like me dont misread your question. It will also help attract those people who know the topic well, so that gives you a better chance of getting your question answered correctly.
Rajni from delhi 16-Feb-11 1:48am
but when i do like that,it's says 'Please Revise your tag'
Rate this: bad
Please Sign up or sign in to vote.

Solution 3

The text property of the textbox class is a string. It wont even accept System.DBNull.Value as a value. If you set it equal to some other object, it will be cast as string.

Based on this,TextBox1.Text = "" is just as viable as anything else.
Rajni from delhi 16-Feb-11 0:35am
Not Getting.wht should i do to achieve this ?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

    Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170326.1 | Last Updated 16 Feb 2011
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100