Erreur en code vb.net

Résolu
dhouhakh Messages postés 3 Date d'inscription mercredi 27 mai 2015 Statut Membre Dernière intervention 28 mai 2015 - 28 mai 2015 à 11:17
dhouhakh Messages postés 3 Date d'inscription mercredi 27 mai 2015 Statut Membre Dernière intervention 28 mai 2015 - 28 mai 2015 à 12:31
bonjour
j'ai une application en vb.net et je travaille avec snmp mais j'ai un probléme
lorsque en ecrit le code je trouve des erreur :
Erreur 1 Type 'ASOCKETLib.Snmp2' non défini
Erreur 2 Le module 'Constants' ne peut pas être utilisé en tant que type.
quel qu'un me aide svp !!

2 réponses

jordane45 Messages postés 38145 Date d'inscription mercredi 22 octobre 2003 Statut Modérateur Dernière intervention 25 avril 2024 344
28 mai 2015 à 12:01
Bonjour,

Pour améliorer tes chances d'obtenir de l'aide ....... POSTES NOUS ton code.
Sinon.. il sera compliqué de t'aider !

**** Attention ****
Merci de bien vouloir utiliser la coloration syntaxique (les balises de code) lorsque tu postes du code sur le forum.
Explications disponibles ici :
http://codes-sources.commentcamarche.net/faq/10686-le-nouveau-codes-sources-comment-ca-marche#balises-code

.
0
dhouhakh Messages postés 3 Date d'inscription mercredi 27 mai 2015 Statut Membre Dernière intervention 28 mai 2015
28 mai 2015 à 12:31

Module Module1


Sub Main()
Dim objSnmp2 As ASOCKETLib.Snmp2
Dim objConstants As Constants
Dim strAgent As String
Dim strCommunity As String
Dim strOID As String
Dim strNextOID As String
Dim strValue As String
objSnmp2 = New ASOCKETLib.Snmp2()
objConstants = New Constants()
strAgent = "127.0.0.1"
strCommunity = "public"
strOID = "system.sysName.0"
objSnmp2.Open(strAgent, strCommunity)
Console.WriteLine("Open( " & strAgent & ", " & strCommunity & "), result: " & objSnmp2.LastError & " (" & objSnmp2.GetErrorDescription(objSnmp2.LastError) & ")")
If (objSnmp2.LastError = objConstants.asERR_SUCCESS) Then
Do
strValue = objSnmp2.Get(strOID)
Console.WriteLine(strOID + " : ")
Console.WriteLine("Value:" & strValue & "Type:" & objSnmp2.GetType())
' NOTE: the Types retunred by GetType() are explained in constants.cs
strNextOID = objSnmp2.GetNext(strOID)
strOID = strNextOID
Loop Until (objSnmp2.LastError <> 0)
End If
Console.WriteLine("Ready.")
System.Threading.Thread.Sleep(10000)
End Sub


End Module

0
Rejoignez-nous