469,352 Members | 2,054 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,352 developers. It's quick & easy.

VB.NET SNMP example

I am looking a VB.NET example on how to reference the SNMP API information.
I am unable to add references to SNMPAPI.LIB or SNMPAPI.DLL.

My goal is to write a 100% VB.NET example (no C or C# code) of some simple
snmp commands. All examples I can find are written in C or C#. There is an
extensive snmp.h file, but I cannot find the equivalent for VB or figure out
how to manually create the equivalent in VB

All I need is a starting point. For example - successfull compilation with
all references resolved to call the SnmpMgrOpen function

Jul 21 '05 #1
5 16499
My question is not really about SNMP as it is about properly referencing an
object. For example, if I have the following VB code

Dim lpMgrSession As Long
Dim lpAgentAddress As String
Dim lpAgentCommunity As String
Dim nTimeOut As Long
Dim nRetries As Long
lpMgrSession = SnmpMgrOpen(lpAgentAddress, lpAgentCommunity,
nTimeOut, nRetries)

I get the following error when I try to run

Name 'SnmpMgrOpen' is not declared.

The documentation indicates that the function is in MGMTAPI.DLL. My
challenge is that I have been unable to add this DLL as a reference. If I go
to Project/add reference and attempt to add under any of the tabs - .NET,
COM, or Projects, I get an error stating "This is not a valid assembly of COM
component"

What do I need to do in order to get VB.NET to understand how to call this
function?

"mony" wrote:
I am looking a VB.NET example on how to reference the SNMP API information.
I am unable to add references to SNMPAPI.LIB or SNMPAPI.DLL.

My goal is to write a 100% VB.NET example (no C or C# code) of some simple
snmp commands. All examples I can find are written in C or C#. There is an
extensive snmp.h file, but I cannot find the equivalent for VB or figure out
how to manually create the equivalent in VB

All I need is a starting point. For example - successfull compilation with
all references resolved to call the SnmpMgrOpen function

Jul 21 '05 #2
You said that you found references for how to do this in C#, right? C# is
just managed code, just like VB.Net. The reference mechanism works exactly
the same way. Follow the directions you found for C# for adding a
reference.

It is best not to try to jump from C to VB.Net. That's not so easy to do.

--
--- Nick Malik [Microsoft]
MCSD, CFPS, Certified Scrummaster
http://blogs.msdn.com/nickmalik

Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a
programmer helping programmers.
--
"mony" <mo**@discussions.microsoft.com> wrote in message
news:3B**********************************@microsof t.com...
My question is not really about SNMP as it is about properly referencing
an
object. For example, if I have the following VB code

Dim lpMgrSession As Long
Dim lpAgentAddress As String
Dim lpAgentCommunity As String
Dim nTimeOut As Long
Dim nRetries As Long
lpMgrSession = SnmpMgrOpen(lpAgentAddress, lpAgentCommunity,
nTimeOut, nRetries)

I get the following error when I try to run

Name 'SnmpMgrOpen' is not declared.

The documentation indicates that the function is in MGMTAPI.DLL. My
challenge is that I have been unable to add this DLL as a reference. If I
go
to Project/add reference and attempt to add under any of the tabs - .NET,
COM, or Projects, I get an error stating "This is not a valid assembly of
COM
component"

What do I need to do in order to get VB.NET to understand how to call this
function?

"mony" wrote:
I am looking a VB.NET example on how to reference the SNMP API
information.
I am unable to add references to SNMPAPI.LIB or SNMPAPI.DLL.

My goal is to write a 100% VB.NET example (no C or C# code) of some
simple
snmp commands. All examples I can find are written in C or C#. There is
an
extensive snmp.h file, but I cannot find the equivalent for VB or figure
out
how to manually create the equivalent in VB

All I need is a starting point. For example - successfull compilation
with
all references resolved to call the SnmpMgrOpen function

Jul 21 '05 #3
The c code I want to emulate is very simple:

#include <snmp.h>
#include <mgmtapi.h>

I can't include the .h files in VB and I cannot figure out out to properly
reference the fucntion call that is in a specific library. I know this
shoudl be something simple, but I can't figure it out.

"Nick Malik [Microsoft]" wrote:
You said that you found references for how to do this in C#, right? C# is
just managed code, just like VB.Net. The reference mechanism works exactly
the same way. Follow the directions you found for C# for adding a
reference.

It is best not to try to jump from C to VB.Net. That's not so easy to do.

--
--- Nick Malik [Microsoft]
MCSD, CFPS, Certified Scrummaster
http://blogs.msdn.com/nickmalik

Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a
programmer helping programmers.
--
"mony" <mo**@discussions.microsoft.com> wrote in message
news:3B**********************************@microsof t.com...
My question is not really about SNMP as it is about properly referencing
an
object. For example, if I have the following VB code

Dim lpMgrSession As Long
Dim lpAgentAddress As String
Dim lpAgentCommunity As String
Dim nTimeOut As Long
Dim nRetries As Long
lpMgrSession = SnmpMgrOpen(lpAgentAddress, lpAgentCommunity,
nTimeOut, nRetries)

I get the following error when I try to run

Name 'SnmpMgrOpen' is not declared.

The documentation indicates that the function is in MGMTAPI.DLL. My
challenge is that I have been unable to add this DLL as a reference. If I
go
to Project/add reference and attempt to add under any of the tabs - .NET,
COM, or Projects, I get an error stating "This is not a valid assembly of
COM
component"

What do I need to do in order to get VB.NET to understand how to call this
function?

"mony" wrote:
I am looking a VB.NET example on how to reference the SNMP API
information.
I am unable to add references to SNMPAPI.LIB or SNMPAPI.DLL.

My goal is to write a 100% VB.NET example (no C or C# code) of some
simple
snmp commands. All examples I can find are written in C or C#. There is
an
extensive snmp.h file, but I cannot find the equivalent for VB or figure
out
how to manually create the equivalent in VB

All I need is a starting point. For example - successfull compilation
with
all references resolved to call the SnmpMgrOpen function


Jul 21 '05 #4
I haven't used it, but here's a .NET SNMP library. I don't know which link
contains the latest version of the library.

http://www.c-sharpcorner.com/Code/2002/Sept/SnmpLib.asp
http://www.csharphelp.com/archives2/archive380.html

Hope this helps,

Richard Rosenheim

"mony" <mo**@discussions.microsoft.com> wrote in message
news:39**********************************@microsof t.com...
The c code I want to emulate is very simple:

#include <snmp.h>
#include <mgmtapi.h>

I can't include the .h files in VB and I cannot figure out out to properly
reference the fucntion call that is in a specific library. I know this
shoudl be something simple, but I can't figure it out.

"Nick Malik [Microsoft]" wrote:
You said that you found references for how to do this in C#, right? C# is just managed code, just like VB.Net. The reference mechanism works exactly the same way. Follow the directions you found for C# for adding a
reference.

It is best not to try to jump from C to VB.Net. That's not so easy to do.
--
--- Nick Malik [Microsoft]
MCSD, CFPS, Certified Scrummaster
http://blogs.msdn.com/nickmalik

Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a
programmer helping programmers.
--
"mony" <mo**@discussions.microsoft.com> wrote in message
news:3B**********************************@microsof t.com...
My question is not really about SNMP as it is about properly referencing an
object. For example, if I have the following VB code

Dim lpMgrSession As Long
Dim lpAgentAddress As String
Dim lpAgentCommunity As String
Dim nTimeOut As Long
Dim nRetries As Long
lpMgrSession = SnmpMgrOpen(lpAgentAddress, lpAgentCommunity,
nTimeOut, nRetries)

I get the following error when I try to run

Name 'SnmpMgrOpen' is not declared.

The documentation indicates that the function is in MGMTAPI.DLL. My
challenge is that I have been unable to add this DLL as a reference. If I go
to Project/add reference and attempt to add under any of the tabs - ..NET, COM, or Projects, I get an error stating "This is not a valid assembly of COM
component"

What do I need to do in order to get VB.NET to understand how to call this function?

"mony" wrote:

> I am looking a VB.NET example on how to reference the SNMP API
> information.
> I am unable to add references to SNMPAPI.LIB or SNMPAPI.DLL.
>
> My goal is to write a 100% VB.NET example (no C or C# code) of some
> simple
> snmp commands. All examples I can find are written in C or C#. There is> an
> extensive snmp.h file, but I cannot find the equivalent for VB or figure> out
> how to manually create the equivalent in VB
>
> All I need is a starting point. For example - successfull compilation> with
> all references resolved to call the SnmpMgrOpen function
>


Jul 21 '05 #5
Your original post said: " All examples I can find are written in C or C#.
"

I would suggest that you refer to an example written in C#.
The include that you mention below is from C, not C#. These are
dramatically different languages.
They are NOT interchangable.

Once again, I suggest that you use the C# examples to start with.

--
--- Nick Malik [Microsoft]
MCSD, CFPS, Certified Scrummaster
http://blogs.msdn.com/nickmalik

Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a
programmer helping programmers.
--
"mony" <mo**@discussions.microsoft.com> wrote in message
news:39**********************************@microsof t.com...
The c code I want to emulate is very simple:

#include <snmp.h>
#include <mgmtapi.h>

I can't include the .h files in VB and I cannot figure out out to properly
reference the fucntion call that is in a specific library. I know this
shoudl be something simple, but I can't figure it out.

"Nick Malik [Microsoft]" wrote:
You said that you found references for how to do this in C#, right? C#
is
just managed code, just like VB.Net. The reference mechanism works
exactly
the same way. Follow the directions you found for C# for adding a
reference.

It is best not to try to jump from C to VB.Net. That's not so easy to
do.

--
--- Nick Malik [Microsoft]
MCSD, CFPS, Certified Scrummaster
http://blogs.msdn.com/nickmalik

Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a
programmer helping programmers.
--
"mony" <mo**@discussions.microsoft.com> wrote in message
news:3B**********************************@microsof t.com...
> My question is not really about SNMP as it is about properly
> referencing
> an
> object. For example, if I have the following VB code
>
> Dim lpMgrSession As Long
> Dim lpAgentAddress As String
> Dim lpAgentCommunity As String
> Dim nTimeOut As Long
> Dim nRetries As Long
> lpMgrSession = SnmpMgrOpen(lpAgentAddress, lpAgentCommunity,
> nTimeOut, nRetries)
>
> I get the following error when I try to run
>
> Name 'SnmpMgrOpen' is not declared.
>
> The documentation indicates that the function is in MGMTAPI.DLL. My
> challenge is that I have been unable to add this DLL as a reference.
> If I
> go
> to Project/add reference and attempt to add under any of the tabs -
> .NET,
> COM, or Projects, I get an error stating "This is not a valid assembly
> of
> COM
> component"
>
> What do I need to do in order to get VB.NET to understand how to call
> this
> function?
>
> "mony" wrote:
>
>> I am looking a VB.NET example on how to reference the SNMP API
>> information.
>> I am unable to add references to SNMPAPI.LIB or SNMPAPI.DLL.
>>
>> My goal is to write a 100% VB.NET example (no C or C# code) of some
>> simple
>> snmp commands. All examples I can find are written in C or C#. There
>> is
>> an
>> extensive snmp.h file, but I cannot find the equivalent for VB or
>> figure
>> out
>> how to manually create the equivalent in VB
>>
>> All I need is a starting point. For example - successfull compilation
>> with
>> all references resolved to call the SnmpMgrOpen function
>>


Jul 21 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Gionni | last post: by
10 posts views Thread by Matthew Bell | last post: by
3 posts views Thread by Kevin Ingram | last post: by
1 post views Thread by ZacBowling | last post: by
2 posts views Thread by TiToine | last post: by
5 posts views Thread by mony | last post: by
1 post views Thread by Dirk Van de moortel | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
1 post views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.