有做过PISDKDlg.TagSearch的没?(C#)
现在想做个 Tag查询,引用了PISDK.DLL,PISDKDlg.DLL,可是用了下面三种都显示不出来(红色语句出现异常)请问在.net(C#)该怎么写的?
代码1:
PISDKDlg.ApplicationObject myAppObject;
PISDKDlg.TagSearch myTagSearch;
PISDK._PointList myPointList;
PISDKCommon.NamedValues nvsSelServers;
PISDKDlg.TagSearchOptions tsOptions;
myAppObject = new PISDKDlg.ApplicationObjectClass();
myTagSearch = myAppObject.TagSearch;
nvsSelServers = new PISDKCommon.NamedValuesClass();
nvsSelServers.LoadFromString("localhost");
tsOptions = PISDKDlg.TagSearchOptions.tsoptSingleSelect;
myPointList = myTagSearch.Show(nvsSelServers,tsOptions);
异常详细信息: System.InvalidCastException: 不支持此接口
代码2:
PISDKDlg.ApplicationObject ao;
PISDKDlg.TagSearch ts;
PISDK._PointList pl;
PISDKCommon.NamedValues nv;
PISDKDlg.TagSearchOptions tso;
ao = new PISDKDlg.ApplicationObjectClass();
ts = ao.TagSearch;
nv = new NamedValuesClass();
tso = TagSearchOptions.tsoptSingleSelect;
pl = ts.Show(nv,tso);
异常详细信息: System.InvalidCastException: 不支持此接口
代码3:
PISDK.IPISDK pisdk = new PISDK.PISDKClass();
PISDK.Server pis;
PISDK.PointList pl;
pis = pisdk.Servers.DefaultServer;
PISDKDlg.TagSearch ts = new PISDKDlg.TagSearchClass();
PISDKCommon.NamedValues nv = new PISDKCommon.NamedValuesClass();
nv.LoadFromString("localhost");
pl = ts.Show(nv,TagSearchOptions.tsoptSingleSelect);
异常详细信息: System.InvalidCastException: 接口 PISDKDlg._TagSearch 的 QueryInte易做图ce 失败。 --------------------编程问答-------------------- 最近也在研究PI,看你的代码是没问题,可能最打的原因是你没装PI-DATALINK吧,TagSearch 是一个预先做好的窗口是要系统又才可以调用的。
补充:.NET技术 , ASP.NET