Results 1 to 7 of 7

Thread: C# to VB>NET

  1. #1

    Thread Starter
    Hyperactive Member wolfrose's Avatar
    Join Date
    Aug 2002
    Location
    Indiana
    Posts
    309

    Question C# to VB>NET

    I am in the process of translating a C# Class into a VB.NET class. My problem is, I have one line that I cannot decipher. This line is:
    VB Code:
    1. networkStream.BeginRead(bytes,1,1,new AsyncCallback( TcpDataRecieve ), myPOP);
    TcpDataRecieve is declared as:
    VB Code:
    1. Public Sub TcpDataRecieve(ByVal ar As IAsyncResult)
    Can anybody help me decipher this line? It is the only one I cannot decipher

  2. #2
    yay gay PT Exorcist's Avatar
    Join Date
    Apr 2002
    Location
    . . . my reason of shame
    Posts
    2,729
    if i am not in mistake it should be exactly the same ..just remove the ; in the end..
    \m/\m/

  3. #3

    Thread Starter
    Hyperactive Member wolfrose's Avatar
    Join Date
    Aug 2002
    Location
    Indiana
    Posts
    309
    When I do that I get:
    ASyncCallBack is a delegate type. Delegate construction permits only a singly AddressOf expression as an argument list. Often an AddressOf expression can be used instead.

  4. #4
    yay gay PT Exorcist's Avatar
    Join Date
    Apr 2002
    Location
    . . . my reason of shame
    Posts
    2,729
    ah now i see: try this:
    VB Code:
    1. networkStream.BeginRead(bytes,1,1,addressof AsyncCallback( TcpDataRecieve ), myPOP);
    hope it works
    \m/\m/

  5. #5

    Thread Starter
    Hyperactive Member wolfrose's Avatar
    Join Date
    Aug 2002
    Location
    Indiana
    Posts
    309
    Now I get:
    ASyncCallBack is a type and cannot be used as an expression.
    And:
    Argument not specified for parameter 'ar' of 'Public Sub TcpDataRecieve(ar as System.IASyncResult)

    If you know of a Pop3 server class that works, let me know. It would save me a lot of time and trouble

  6. #6
    Frenzied Member DevGrp's Avatar
    Join Date
    Nov 2001
    Location
    Charlotte, NC
    Posts
    1,256
    This is what it should be.
    VB Code:
    1. networkStream.BeginRead(bytes,1,1, AsyncCallback(addressof TcpDataRecieve ), myPOP)

    Here is an excellent article on Delegates
    http://msdn.microsoft.com/library/de...egates/TOC.ASP
    Dont gain the world and lose your soul

  7. #7
    yay gay PT Exorcist's Avatar
    Join Date
    Apr 2002
    Location
    . . . my reason of shame
    Posts
    2,729
    i never got to understand very good delegates in vb.net :\
    \m/\m/

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width