Click here to Skip to main content
15,891,184 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi friends.

i have a form that it has some label on it. i want to show one of label's value in crystal report.
how can i do that? i do not want to restore it in database after that use it's value in crystal reports.

thanks for your answer.
Posted

1 solution

Hi,

So just create a parameter in your report and then pass it the label value in your code

yourReport.SetParameterValue("yourParameter", yourLabel.Text);
 
Share this answer
 
Comments
_Starbug_ 28-Aug-14 6:28am    
thanks but an error occur and say that

invalid index. (Exception from HRESULT:0x8002000B(DISP_E_BADINDEX))
pjaar89 28-Aug-14 7:31am    
Did you add a parameter in the Crystal Report Designer first?
_Starbug_ 28-Aug-14 8:36am    
yes i added. and instead of parameter name i now use index. when crystal report is loading a page appear and want parameter value.
this is my code.
objRpt.SetParameterValue(0, (object)label16.Text);

when crystal report load. first a page appear and want to add a value for my parameter. what is wrong and how i can add value for parameter without entering value in this page?thanks.
pjaar89 28-Aug-14 8:59am    
this should give you an idea
http://www.it-sideways.com/2011/10/how-to-disable-parameter-prompt-for.html

_Starbug_ 28-Aug-14 9:15am    
i want just pass one parameter to crystal report. i just need 1 or 2 line of code.

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