Results 1 to 7 of 7

Thread: Are there pointers in VB

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Nov 2001
    Location
    Mass USA
    Posts
    1,674

    Are there pointers in VB

    I would like to use a pointer to alter the contents of a few different variables. I know how to do it in C but I was wondering if I could do it in VB?

  2. #2
    Frenzied Member
    Join Date
    Jun 2000
    Location
    East Providence, RI
    Posts
    1,715
    you can do like

    VB Code:
    1. intABC= intDEF

    -Dimava
    NXSupport - Your one-stop source for computer help

  3. #3
    PowerPoster rjlohan's Avatar
    Join Date
    Sep 2001
    Location
    Sydney, Australia
    Posts
    3,205
    Not directly.
    You can pass argumanets to functions ByVal or ByRef but that's it, I believe.
    -----------------------------------------
    -RJ
    [email protected]
    -----------------------------------------

  4. #4
    PowerPoster abdul's Avatar
    Join Date
    Dec 2000
    Location
    Ontario,Canada
    Posts
    2,827
    And for more reference...if you pass a variable as "ByRef"(which is the default), and when you change the value of that variable, it'll effect the actual variable passed to the function. On the other side, if you pass a variable as "ByVal", the function makes a copy of that variable into the memory and works with that. It does not effect the actual variabel passed to the function.
    This kind of stuff is similar to pointers but not as powerful as they are.
    Baaaaaaaaah

  5. #5
    gaffa
    Guest
    There are also a handful of undocumented functions that will allow you to deal with pointers in VB.

    ObjPtr
    VarPtr
    StrPtr (or maybe it's StringPtr)

    In the MSDN, there a complete book called "Hardcore Visual Basic" (by Bruce McKinney). This has some pretty indepth discussions on how to use these fucntions in VB without blowing away your machine.

    - gaffa

  6. #6
    Tygur
    Guest
    Originally posted by gaffa
    There are also a handful of undocumented functions that will allow you to deal with pointers in VB.

    ObjPtr
    VarPtr
    StrPtr (or maybe it's StringPtr)

    In the MSDN, there a complete book called "Hardcore Visual Basic" (by Bruce McKinney). This has some pretty indepth discussions on how to use these fucntions in VB without blowing away your machine.

    - gaffa
    Play around with those and CopyMemory and you can use pointers, but I don't think it's very practical for most purposes. From what I understand, pointers are used all the time in C++.

    If I want pointers (so I can do things like linked lists, etc), I just make class modules. Object variables act just like pointers. It's probably not very efficient, but it works.

  7. #7
    Frenzied Member Tec-Nico's Avatar
    Join Date
    Jun 2002
    Location
    México
    Posts
    1,192

    Lightbulb How?

    How do you apply that?

    I am trying to design a tree structure... So how can I point to another node? What do you suggest me?
    We miss you, friend... Rest in Peace, we will take care of the rest of it.

    [vbcode]
    On Error Me.Fault = False
    [/vbcode]
    - Silence is the human way to share ignorance
    Tec-Nico

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