Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6889199
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T06:07:32+00:00 2026-05-27T06:07:32+00:00

I am trying to update an ancient VB6 project to enable communication with a

  • 0

I am trying to update an ancient VB6 project to enable communication with a remote OPC Server. I have installed the Siemens toolkit but I am unable to find any useful documentation on how to use it with VB6. (Works with C#)

The application is very simple. I just need to connect to the remote server and write/read single addresses.

I found the DatCon OCX control which I assume handles the communication but all the ServerName values I tried to enter by hand did not work.

Can anyone help?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T06:07:32+00:00Added an answer on May 27, 2026 at 6:07 am

    Since posting, I did make some progress. The following example helped me to get going.

    http://support.automation.siemens.com/WW/llisapi.dll?func=cslib.csinfo&objId=25229521&load=treecontent&lang=en&siteid=cseus&aktprim=0&objaction=csview&extranet=standard&viewreg=WW

    Here is my current code. It’s not much – just makes contact with the server and tries to write a value. I didn’t get any further. I started getting COM errors and assumed the installation was bad (I had had problems installing) so I decided to reinstall. It didn’t work. Installation was impossible. Waiting for an upgrade from Siemens.

    '
    ' OPC Communication
    '
    ' Paul Ramsden 24.11.2011
    '
    '
    
    Option Explicit
    Option Base 1
    
    Public MyOpcServer As OPCServer
    Public ServerHandle As Variant
    
    Private ServerName As String
    Private ServerNode As String
    Private TestGroup As OPCGroup
    Private MyOpcItem As OPCItem
    Private IsInitialised As Boolean
    
    
    Public Sub InitialiseOPC()
        On Error GoTo ProcError
        IsInitialised = False
    
        Set MyOpcServer = New OPCServer
        ServerNode = "xyz.abc.10.101"
        ServerName = "OPC.SimaticNET.1"
        Dim LocalServers
        LocalServers = MyOpcServer.GetOPCServers(ServerNode)
        Dim tmp
        ServerHandle = ""
        For Each tmp In LocalServers
            If CStr(tmp) = ServerName Then
                Call MyOpcServer.Connect(tmp)
                MsgBox MyOpcServer.ServerNode & vbCr & MyOpcServer.ServerName & vbCr & MyOpcServer.ServerState
                ServerHandle = tmp
                Set TestGroup = MyOpcServer.OPCGroups.Add("TestGroup")
                Exit For
            End If
        Next
    
        If ServerHandle = "" Then
            MsgBox "Could not find server " & ServerName & " on " & ServerNode
        Else
            IsInitialised = True
        End If
    ProcExit:
        Exit Sub
    
    ProcError:
        MsgBox Err.Description
        Resume ProcExit
    End Sub
    
    Private Sub ClearGroup()
        Dim handles() As Long
        Dim errors() As Long
    
        Call TestGroup.OPCItems.Remove(TestGroup.OPCItems.Count, handles, errors)
    End Sub
    
    Public Sub WriteOPC(address As String, value As String)
        On Error GoTo ProcError
        Call ClearGroup
        Set MyOpcItem = TestGroup.OPCItems.AddItem(address, 2011)
        MyOpcItem.Write (value)
        Exit Sub
    
    ProcError:
        MsgBox "Write error! " & Err.Description
    End Sub
    
    Public Function ReadOPC(address As String) As String
        On Error GoTo ProcError
    
        Call ClearGroup
        Set MyOpcItem = TestGroup.OPCItems.AddItem(address, 2011)
        Dim value As String
        ReadOPC = MyOpcItem.Read
    
    ProcError:
        MsgBox "Read error! " & Err.Description
    End Function
    
    Public Sub TestOPC()
        InitialiseOPC
        WriteOPC "SIMATIC 300(1).CPU 315-2 DP.Q0_0TestAusgang1", "1"
    End Sub
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Trying to update a table on a linked server (SQL 2000/2005) but my server
In trying to update my SDK to the latest, some things installed, but others*
I'm trying to update the display brightness from a widget but i have some
I trying to update a model on a callback but the validation is causing
I'm trying to update a hashtable in a loop but getting an error: System.InvalidOperationException:
I'm trying to update my database table with PDO, but to avoid security leaks,
I am trying to update an old VB6 application. I am struggling with changing
I'm trying to update my current project from 1.7 to 1.8. What do I
I'm trying to update my iPhone to the 3.0 beta 5 OS, but I
I'm trying to update one textfield from another class: I have two classes: @interface

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.