问题描述
通过添加对 VisM.ocx 的引用并将其作为 ActiveX 控件添加到我的工具箱中,我已将 VisM 控件添加到 vb.net 中.
I have dded a VisM control into vb.net via adding a reference to VisM.ocx and adding it in my toolbox as an activeX control.
我在按钮中添加了以下代码:
I added the following code in a button:
Try
'open the connection
AxVisM1.Connect("CN_IPTCP:127.0.0.1[1972]")
'set namespace to livedata (for formal namespaces, use the @ symbol)
AxVisM1.NameSpace = "LIVEDATA"
'do stuff.
MsgBox("Cache is now active")
'close the connection
AxVisM1.DeleteConnection()
Catch ex As Exception
'close the connection
AxVisM1.DeleteConnection()
MsgBox(ex.ToString)
End Try
从这里,我需要从名为 ^BACKTR("INDX","COMPANY",
的 GLOBAL 输出变量
From here, I need to output variables from GLOBALs named ^BACKTR("INDX","COMPANY",
如何将全局变量中的所有/部分变量输出到列表、数据表或单个变量中?我所需要的只是在 VB.net 中访问它,然后我就可以在我的项目中使用上述 GLOBAL.即使输出是原始的(不在列或任何内容中,即: ^BACKTR("INDX","COMPANY",1,63572,9792) = ""
因为从它我已经可以在我的应用程序中使用数据
how do I output all/some variables from this GLOBALs into a list, a datatable, or a single variable even? All I need is to access it in VB.net and from there I can work with the said GLOBALs for my project. I will accept even if the output is raw (not in columns or anything ie: ^BACKTR("INDX","COMPANY",1,63572,9792) = ""
as from it I can already use the data in my application
推荐答案
像这样,下面的代码从 ^BACKTR("DATA","STATISTICS")
读取数据并将其放入 ListVew.它使用 AxVisM1.Execute
执行用于获取数据的 COS 代码.查看 $order 函数,以及关于 vism 在文档中
Something like this, code below reads data from ^BACKTR("DATA","STATISTICS")
and puts it to ListVew. It executes COS code for getting data with AxVisM1.Execute
. Look at $order function, and about P0 and VALUE in vism in documentation
Dim cnt As Integer = 0
ListView1.Items.Clear()
ListView1.Columns.Clear()
ListView1.Columns.Add("#")
ListView1.Columns.Add("ID")
For i = 1 To 25
ListView1.Columns.Add("Prop" + i.ToString)
Next
AxVisM1.P0 = ""
While True
AxVisM1.Execute("set P0=$order(^BACKTR(""DATA"",""STATISTICS"",P0),1,VALUE)")
If (AxVisM1.P0 = "") Then
Exit While
End If
cnt = cnt + 1
If (cnt > 100) Then
Exit While
End If
Dim data() As String = Split(AxVisM1.VALUE, Chr(1).ToString)
Dim line As ListViewItem = New ListViewItem(cnt)
line.SubItems.Add(AxVisM1.P0.ToString)
line.SubItems.AddRange(data)
ListView1.Items.Add(line)
End While
这篇关于使用 VisM 输出 GLOBALS 列表或单个 GLOBAL 值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!