Home All Groups Group Topic Archive Search About
Author
7 Apr 2005 9:24 AM
ME
Hello,

I need some help translating this code to vb.net

..........
private dotnetWinpCap.ReceivePacket rcvPack=null;
..........

if (rcvPack==null)
{
    rcvPack=new dotnetWinpCap.ReceivePacket(this.ReceivePacket);
    wpcap.OnReceivePacket+=rcvPack;
}

Thanks for the help.

Author
7 Apr 2005 9:42 AM
Supra
http://www.kamalpatel.net/

ME wrote:

Show quoteHide quote
>Hello,
>
>I need some help translating this code to vb.net
>
>.........
>private dotnetWinpCap.ReceivePacket rcvPack=null;
>.........
>
>if (rcvPack==null)
>{
>    rcvPack=new dotnetWinpCap.ReceivePacket(this.ReceivePacket);
>    wpcap.OnReceivePacket+=rcvPack;
>}
>
>Thanks for the help.
>
>
>
>
>

>
Author
7 Apr 2005 9:50 AM
Herfried K. Wagner [MVP]
"ME" <inva***@invalid.com> schrieb:
> I need some help translating this code to vb.net
>
> .........
> private dotnetWinpCap.ReceivePacket rcvPack=null;
> .........
>
> if (rcvPack==null)
> {
>    rcvPack=new dotnetWinpCap.ReceivePacket(this.ReceivePacket);
>    wpcap.OnReceivePacket+=rcvPack;
> }

\\\
Private rcvPack As dotnetWinpCap.ReceivePacket rcvPack
..
..
..
If rcvPack Is Nothing Then

    ' Depending on the purpose of the last constructors parameter
    ' 'AddressOf' might be necessary...
    rcvPack = New dotnetWinpCap.ReceivePacket rcvPack(Me.ReceivePacket)
    AddHandler wpcap.OnReceivePacket, AddressOf rcvPack
End If
///

Converting code between .NET programming languages
<URL:http://dotnet.mvps.org/dotnet/faqs/?id=languageconverters&lang=en>

--
M S   Herfried K. Wagner
M V P  <URL:http://dotnet.mvps.org/>
V B   <URL:http://classicvb.org/petition/>
Author
7 Apr 2005 10:05 AM
ME
thanks, but I can't get it to work

it's a simple sample application from
http://www.codeproject.com/dotnet/dotnetwinpcap.asp but I can't get it to
work in vb.net

Show quoteHide quote
"Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> wrote in message
news:OYbu7c1OFHA.3788@tk2msftngp13.phx.gbl...
> "ME" <inva***@invalid.com> schrieb:
>> I need some help translating this code to vb.net
>>
>> .........
>> private dotnetWinpCap.ReceivePacket rcvPack=null;
>> .........
>>
>> if (rcvPack==null)
>> {
>>    rcvPack=new dotnetWinpCap.ReceivePacket(this.ReceivePacket);
>>    wpcap.OnReceivePacket+=rcvPack;
>> }
>
> \\\
> Private rcvPack As dotnetWinpCap.ReceivePacket rcvPack
> .
> .
> .
> If rcvPack Is Nothing Then
>
>    ' Depending on the purpose of the last constructors parameter
>    ' 'AddressOf' might be necessary...
>    rcvPack = New dotnetWinpCap.ReceivePacket rcvPack(Me.ReceivePacket)
>    AddHandler wpcap.OnReceivePacket, AddressOf rcvPack
> End If
> ///
>
> Converting code between .NET programming languages
> <URL:http://dotnet.mvps.org/dotnet/faqs/?id=languageconverters&lang=en>
>
> --
> M S   Herfried K. Wagner
> M V P  <URL:http://dotnet.mvps.org/>
> V B   <URL:http://classicvb.org/petition/>
Author
7 Apr 2005 10:06 AM
Herfried K. Wagner [MVP]
"ME" <inva***@invalid.com> schrieb:
> thanks, but I can't get it to work

Which error message do you get?

--
M S   Herfried K. Wagner
M V P  <URL:http://dotnet.mvps.org/>
V B   <URL:http://classicvb.org/petition/>
Author
7 Apr 2005 10:10 AM
ME
> Which error message do you get?
>
dotnetWinpCap.ReceivePacket is a delegate type (with the new)
is a type and cannot be used as an expression (without the new)
Author
7 Apr 2005 10:12 AM
ME
> Which error message do you get?
>
this is my receivepacket:

Sub ReceivePacket(ByVal sender As Object, ByVal p As PacketHeader, ByVal s
As Byte)
Author
7 Apr 2005 1:24 PM
Chris Dunaway
You have a little mistake:

>> Private rcvPack As dotnetWinpCap.ReceivePacket rcvPack

should read:

Private rcvPack As dotnetWinpCap.ReceivePacket
Author
7 Apr 2005 5:36 PM
Herfried K. Wagner [MVP]
"Chris Dunaway" <dunaw***@gmail.com> schrieb:
> You have a little mistake:
>
>>> Private rcvPack As dotnetWinpCap.ReceivePacket rcvPack
>
> should read:
>
> Private rcvPack As dotnetWinpCap.ReceivePacket

Ooops...  Copy and paste seems to be too complicated for me ;-).

--
M S   Herfried K. Wagner
M V P  <URL:http://dotnet.mvps.org/>
V B   <URL:http://classicvb.org/petition/>