原創(chuàng)|使用教程|編輯:鄭恭琳|2015-12-10 09:34:30.000|閱讀 2242 次
概述:本片文章主要介紹Stimulsoft Reports.Net開發(fā)者在處理變量時遇到的常見問題及解決方案。
# 界面/圖表報表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
相關(guān)鏈接:
< Stimulsoft Reports.Net v2015.3最新版本下載>
可以使用以下代碼來實現(xiàn)給報表添加變量。
添加int型的MyVariable變量代碼示例:
C#
report.Dictionary.Variables.Add(new StiVariable("Category", "MyVariable", typeof(int), "1", false));
VB
Report.Dictionary.Variables.Add(New StiVariable("Category", "MyVariable", CType(GetType(int), Type),
"1", False))
添加string型的MyVariable變量代碼示例:
C#
report.Dictionary.Variables.Add(new StiVariable("Category", "MyVariable", typeof(string), "1", false));
VB
Report.Dictionary.Variables.Add(New StiVariable("Category", "MyVariable", CType(GetType(String),
Type), """1""", False))
要訪問變量的值,你可以使用以下代碼:
C#
StiReport report = new StiReport();
report.Load("Variables.mrt");
report.Compile();
//設(shè)置變量
report["VariableName"] = "Value";
//獲取變量
object value = report["VariableName"];
VB
Dim Report As StiReport = New StiReport()
Report.Load("Variables.mrt")
Report.Compile()
'設(shè)置變量
Report.Item("VariableName") = " Value "
'獲取變量
Dim Value As Object = Report.Item("VariableName")
使用以下代碼:
text1.Text = "{PageNofM}";
購買最新正版授權(quán)!""
慧都年終盛典火爆開啟,一年僅一次的最強(qiáng)促銷,破冰鉅惠不容錯過!!優(yōu)惠詳情點擊查看>>
本站文章除注明轉(zhuǎn)載外,均為本站原創(chuàng)或翻譯。歡迎任何形式的轉(zhuǎn)載,但請務(wù)必注明出處、不得修改原文相關(guān)鏈接,如果存在內(nèi)容上的異議請郵件反饋至chenjj@ke049m.cn