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
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    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

  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
  •  



Click Here to Expand Forum to Full Width