c# - 如何显示 PI tagsearch 对话框并将标记名作为字符串返回?

标签 c# winforms user-controls

如何显示 PI Tag 搜索对话框,其次,如何从中获取选定的 tag 名称?

最佳答案

希望对你有用:

private void Button1_Click(object sender, EventArgs e) {
    TagSearch dialog = new TagSearch();

    PointList results = dialog.showTagSearch(
        new string[] { }, SearchOptions.SingleSelect);

    if (results.Count > 0) {
        object index = 1;
        string serverTag = 
            string.Format(
                CultureInfo.InvariantCulture, 
                @"\\{0}\{1}", 
                results.get_Item(ref index).Server.Name, 
                results.get_Item(ref index).Name);
    }
}

关于c# - 如何显示 PI tagsearch 对话框并将标记名作为字符串返回?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5277962/

相关文章:

c# - 使用对象列表填充 UserControl Gridview

c# - 为什么我的 IEnumerable UserControl 在我用 foreach 枚举它之后被处置?

c# - System.Windows.Controls.UserControl 加载事件在 'Unloaded' 时触发

c# - 从其他线程更新GUI

c# - 当用户已经登录时,如何重定向到未授权页面而不是登录页面?

c# - 不使用类字段返回静态数组

vb.net - 如何在vb.net中实现小的延迟?

.net - 使用 CodeDom 编写 VB.NET Windows 窗体应用程序

c# - 访问共享文件夹( protected )

c# - 在 WinForms 应用程序中存储数据