按名称动态分配表单(assigning of forms by name dynamically)

编程入门 行业动态 更新时间:2024-10-28 20:26:44
按名称动态分配表单(assigning of forms by name dynamically)

所以我需要的是这样的东西。 我想调用与变量对应的Web报表。 因此,例如,如果变量值是Test。 我希望调用test.aspx表单。 我想知道这是否可行,所以我不必在报告名称之间切换并将它们分配给每个表单。

switch (reportName) { case reportName: report = new GWL.WebReports.Reports.reportName+".aspx"(); //<-- I need to evaluate something like this break; }

So what I need is something like this. I want to call the web report form that corresponds to a variable. So for example if the variable value is Test. I want the test.aspx form to be called. I wonder if this is possible, so I don't have to switch between names of reports and assigning them to each and every form.

switch (reportName) { case reportName: report = new GWL.WebReports.Reports.reportName+".aspx"(); //<-- I need to evaluate something like this break; }

最满意答案

好吧,我终于明白了。 我从来不知道我仍然可以使用我上一篇文章中使用的方法。

string reportName; Type CAType = Type.GetType("Namespace"+reportName); XtraReport report = (XtraReport)Activator.CreateInstance(CAType);

Well I finally figured it out. I never knew that I can still use the approach that was used in my previous post..

string reportName; Type CAType = Type.GetType("Namespace"+reportName); XtraReport report = (XtraReport)Activator.CreateInstance(CAType);

更多推荐

本文发布于:2023-08-07 17:11:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1465478.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:表单   名称   动态分配   dynamically   assigning

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!