Measurement Studio for VB6

cancel
Showing results for 
Search instead for 
Did you mean: 

how to get the name of tag or variable

Hi everyone,
I am a newbie, I have problem on getting the name or tag of the variable from OLE for Processing Control(OPC) server, could anyone tell me how I can get the name of tag or variable from writting vb codes or please direct me to any helpful information. Here are
my codes,

Dim ItemsDef(NBR_ITEMS) As String
Dim DeviceAddress As String
Dim IndItem As Long

DeviceAddress = "MBT:152.160.178.60"

'Preparing the Handles for "AddItems"

For IndItem = 1 To NBR_ITEMS

ItemsDef(IndItem) = DeviceAddress & "!40000" & Format(IndItem) '40000 is the memory location of variable in the OPC, how can I get the variable name, what is the code or syntax?

Next
blah...


Thank you,
Calvin
0 Kudos
Message 1 of 3
(3,460 Views)
Hi Calvin,

If you are looking for general information and examples about OPC, then we have lots of places for you to browse!
Here is a small list, and you can probably find other links within these documents:

**If you have Measurement Studio from National Instruments, then you can look at the "Measurement Studio Reference" help file. Search for OPC and in the overview you will find the methods for accessing the items on an OPC server.

**Elsewhere in the help file, you can find a link to this Application Note on our developer zone
http://zone.ni.com/devzone/devzoneweb.nsf/opendoc?openagent&F4921B34CA8F4A9786256874005BE3F7&cat=7CDA3E51FEFC4AA2862568B80071A1E2

**One more resource is http://www.ni.com/opc

**Probably the most useful will be the examples yo
u can find on our web site. You can go to http://www.ni.com/support and in Option 3 search the Example Code database for "opc".

In the first example program (Controlling OPC Servers with the OPC Automation API in Visual Basic) that you should get when searching for "opc" in the example programs database, look for the line with this code: "browser.GetItemID(leaf)". There you can see the way the program creates an OPCBrowser from the server instance, and then gets the servers available items for use by the client. This sounds like the specific information you are looking for with the variable name.

If you aren't able to find out your answer here or in the various help resources, then please feel free to contact us at National Instruments at http://www.ni.com/ask

Regards,
John N
Applications Engineer
National Instruments
0 Kudos
Message 2 of 3
(3,460 Views)
How or what can I put instead of 40000 in order to the definition of the variable from the symbol table? Can I put a variable instead? Does anyone know the syntax I should use?

Thanks,
Calvin
0 Kudos
Message 3 of 3
(3,460 Views)