IntPtr - C# to VB.NET-VBForums
Results 1 to 3 of 3

Thread: IntPtr - C# to VB.NET

  1. #1

    Thread Starter
    New Member
    Join Date
    Feb 2005
    Posts
    2

    IntPtr - C# to VB.NET

    I am trying to convert the following C# code into VB.NET and am not able to convert integer to intptr in VB.NET.... Thanks for the help


    int pEv = (int) tgData.pEventActivity;
    Type typ = typeof(EVENTACTIVITYSTRUCT);
    int size = Marshal.SizeOf( typ );

    for(int i = 0; i < tgData.nEvents; i++ )
    {
    EVENTACTIVITYSTRUCT ev = (EVENTACTIVITYSTRUCT) Marshal.PtrToStructure( (IntPtr) pEv, typ );

    textBox1.Text = textBox1.Text + ev.szEventNumber
    pEv += size;
    }

  2. #2
    Moderator.NET kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,246

    Re: IntPtr - C# to VB.NET

    try using the IntPtr data type in VB

    it also has a method .ToInt32 (or .ToInt16) to convert it to an integer
    Using VS.NET 2013/.NET 2.0 through 4.5 * Please mark you thread resolved using the Thread Tools above
    PLEASE INDICATE WHAT VERSION OF VB YOU USE!!!!!!!!!!!
    * If you found a post useful then please Rate it! * DO NOT PM ME WITH LINKS TO YOUR THREADS FOR ANSWERS PLEASE!

    Code Bank:Manipulate HTML Page content in the Web Browser Control from VB - Drag Drop from Windows into Win Form - Launch new default browser instance to open URL - Display Internet Image in Picturebox - Download Files From Web With Progress Bar - IP Textbox User Control - Installing .NET Framework with INNO Setup
    ZerosAndTheOne.com
    -=Matt=-

  3. #3

    Thread Starter
    New Member
    Join Date
    Feb 2005
    Posts
    2

    Re: IntPtr - C# to VB.NET

    kleinma,

    Thanks a lot ... it worked ...

Posting Permissions

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



Featured


Click Here to Expand Forum to Full Width

Survey posted by VBForums.