Click here to Skip to main content
15,900,714 members
Please Sign up or sign in to vote.
3.00/5 (3 votes)
Hi Iam using VS2010. While generating rdlc report, Iam facing very different problem, really it's very very different.

My requirement is once the field pty_name is having "," comma then I wish to make it as double line other wise single line.

The below command works good, when my field pty_name is having comma.
But suppose if there is no comma, then its giving error...

VB
IIf((InStr(1,First(Fields!pty_name.Value, "DataSet1"),",")=0),First(Fields!pty_name.Value, "DataSet1"),Split(Fields!pty_name.Value, ",")(0) & vbcrlf & Split(Fields!pty_name.Value, ",")(1))


The below command works good, when my field pty_name is not having comma. But it's not
adding the second part of string array

VB
IIf((InStr(1,First(Fields!pty_name.Value, "DataSet1"),",")=0),First(Fields!pty_name.Value, "DataSet1"),Split(Fields!pty_name.Value, ",")(0) & vbcrlf )

So how to solve this? And guidances will be helpful..
Thanks
Thanks Again
Posted

1 solution

VB
Try
IIf((InStr(1,First(Fields!pty_name.Value, "DataSet1"),",")=0),First(Fields!pty_name.Value, "DataSet1"),Split(Fields!pty_name.Value, ",")(0) & vbcrlf & Split(Fields!pty_name.Value, ",")(1))

Catch(ex as Exception)
IIf((InStr(1,First(Fields!pty_name.Value, "DataSet1"),",")=0),First(Fields!pty_name.Value, "DataSet1"),Split(Fields!pty_name.Value, ",")(0) & vbcrlf )

End try
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900