I am using VB6 with a Moeller PLC and using OPC Server to connect to the PLC. I am trying to work in some error checking in case the PLC is not powered on while the computer tries to connect to it. Right now, if the PLC is not powered on, the program crashes with the message:
My code for connecting to the PLC is as follows:
I am familiar with error checking in VB (using OnError etc) but I can not seem to trap this one.
Does anyone know how to trap this error? Or maybe there's an easier way to detect if OPC is actually connecting the PLC?
Any information would be greatly appreciated.
Nick
Code:
PCU.exe has generated errors and will be closed by Windows. You will need to restart the program.
An error log is being created."
My code for connecting to the PLC is as follows:
Code:
Set server = New OpcClientX15.OPCServer
server.Connect "CoDeSys.OPC.02"
Set group = server.OPCGroups.Add("Group1")
group.UpdateRate = "1"
Dim item As OpcClientX15.OPCItem
Set item = group.OPCItems.AddItem(".PRESSURE", 0)
Label1(0).Tag = item.ServerHandle
I am familiar with error checking in VB (using OnError etc) but I can not seem to trap this one.
Does anyone know how to trap this error? Or maybe there's an easier way to detect if OPC is actually connecting the PLC?
Any information would be greatly appreciated.
Nick