Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#
Hi,
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
Comments
Sandeep Mewara at 16-Feb-11 5:56am
   
I see you do a repost, why so? Please avoid it in future!
Rate this: bad
good
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?? "".
  Permalink  
Comments
Rajni from delhi at 16-Feb-11 0:27am
   
?? operator is not in RDLC
Abhinav S at 16-Feb-11 0:56am
   
I thought you were writing this line in code as your question tag said C#.
SAKryukov at 16-Feb-11 0:57am
   
I voted 5 before I was this note -- won't hurt I hope :-)
--SA
Abhinav S at 16-Feb-11 1:35am
   
No it wont hurt at all. :)
SAKryukov at 16-Feb-11 0:56am
   
What your tag C# means? It is applicable? If not, remove it, don't confuse people!
--SA
Rajni from delhi at 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 at 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 at 16-Feb-11 1:48am
   
but when i do like that,it's says 'Please Revise your tag'
Rate this: bad
good
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.
  Permalink  
Comments
Rajni from delhi at 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
0 OriginalGriff 275
1 DamithSL 265
2 CPallini 235
3 Maciej Los 185
4 George Jonsson 170
0 OriginalGriff 5,305
1 DamithSL 4,382
2 Maciej Los 3,760
3 Kornfeld Eliyahu Peter 3,470
4 Sergey Alexandrovich Kryukov 2,901


Advertise | Privacy | Mobile
Web01 | 2.8.141216.1 | Last Updated 16 Feb 2011
Copyright © CodeProject, 1999-2014
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