|
-
Nov 28th, 2001, 10:00 PM
#1
Thread Starter
Frenzied Member
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?
-
Nov 28th, 2001, 10:01 PM
#2
Frenzied Member
NXSupport - Your one-stop source for computer help
-
Nov 28th, 2001, 10:02 PM
#3
PowerPoster
Not directly.
You can pass argumanets to functions ByVal or ByRef but that's it, I believe.
-----------------------------------------
-RJ
[email protected]
-----------------------------------------
-
Nov 28th, 2001, 10:20 PM
#4
PowerPoster
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.
-
Nov 28th, 2001, 10:28 PM
#5
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
-
Nov 29th, 2001, 02:32 AM
#6
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.
-
Sep 12th, 2002, 05:24 PM
#7
Frenzied Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|