Je suis entrain de faire un client opc à l'aide d'un projet en VB6 que j'ai converti. Le client est sur la base du client OFS de schneider Electric.
Le probleme s'est que en Vb6 j'avait une instruction set qui ne passe plus sur VB.net.
Voici le code:
Public WithEvents g_Server As SAOPCAutomation.OPCServer Public WithEvents g_Group As SAOPCAutomation.OPCGroup
Public Sub SubConnectServer()
If Not ServerConnected Then
On Error GoTo ErrorHandler
g_Server = New SAOPCAutomation.OPCServer() g_Server.Connect((ServerName)) ServerConnected = True
Else MsgBox("Le serveur est déjà ,connecté !", MsgBoxStyle.Information, "Message") End If
Exit Sub
ErrorHandler: MsgBox(Err.Description & Chr(13) & " Impossible de se connecter au serveur !", MsgBoxStyle.Critical, "ERROR")
End Sub
Public Sub SubCreationGroupe() Dim GroupActive As Boolean Dim LCID As Integer Dim pRevisedUpdateRate As Integer Dim Group As Object Dim updaterate As Integer = 500
If Not ServerConnected Then MsgBox("Aucun serveur connecté !" & Chr(13) & "Connecter un serveur avant de créer un groupe!", 48, "Message") Exit Sub End If
If Not GroupAdded Then GroupName = gaNomGroupe 'Add one group to server Try g_Group = g_Server.OPCGroups.Add(GroupName) ' set g_Group = g_Server.OPCGroups.Add(GroupName) g_Group.ClientHandle = 1 g_Group.DeadBand = 1 g_Group.IsActive = False g_Group.LocaleID = English g_Group.UpdateRate = 500 g_Group.IsSubscribed = True GroupAdded = True Catch ex As Exception MsgBox(Err.Description & Chr(13) & "Impossible de créer un groupe !", MsgBoxStyle.Critical, "ERROR") End Try
Else MsgBox("Le groupe existe déjà !", MsgBoxStyle.Information, "Message") End If
End Sub
|
Le probleme se stitue au moment de créer le groupe.
Tout idée est la bienvenue ainsi que tout code.
Merci de votre réponse.