Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 pointes in VB
Index -> Programming, Visual Basic and Other Basics -> Visual Basic Tutorials
View previous topic Printable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
liangchenen




PostPosted: Mon Oct 03, 2005 11:00 pm   Post subject: pointes in VB

how to make a pointer in VB.

Also, how do you pass by reference in VB?
Sponsor
Sponsor
Sponsor
sponsor
wtd




PostPosted: Tue Oct 04, 2005 1:12 am   Post subject: (No subject)

VB6 or VB.NET?

For VB.NET, to pass by reference, you'd have something like:

code:
Sub Foo(ByRef a As Integer)
   ' ...
End Sub


Pointers you don't really have.
Monstrosity_




PostPosted: Tue Oct 04, 2005 12:01 pm   Post subject: Re: pointes in VB

liangchenen wrote:
how to make a pointer in VB.

Also, how do you pass by reference in VB?

In VB6 (not sure about .NET) there are three undocumented functions

VarPtr: Gives the memory address of a variable
StrPtr: Gives the memory address of the contents of a string
ObjPtr: Gives the memory address of the object
liangchenen




PostPosted: Tue Oct 04, 2005 2:45 pm   Post subject: (No subject)

what if I have something like this:

code:

void add( int a [500]. int b[500])
{
 int x;
 for (x=0;x<500;x++)
 {
  a[x] += b[x];
 }
}

int main()

 int num1[500];
 int num2[500];
 add (num1,num2);
 return 0;
}


This is code in C++, in the function, I pass the pointer of the array num1[500] and num2[500] into the function, so, when I add a[500] and b[500], I am actually manipulate arrays num1 and num2.

Can you show me how it is done in VB6.?
thx a lot
wtd




PostPosted: Tue Oct 04, 2005 4:45 pm   Post subject: (No subject)

Google is your friend, as is MSDN.
Monstrosity_




PostPosted: Tue Oct 04, 2005 7:48 pm   Post subject: (No subject)

liangchenen wrote:
I pass the pointer of the array num1[500] and num2[500] into the function, so, when I add a[500] and b[500], I am actually manipulate arrays num1 and num2.

Can you show me how it is done in VB6.?
thx a lot

In this case you dont need to worry about pointers, just as wtd had mentioned earlier, look up how to pass by refrence instead of by value.
Display posts from previous:   
   Index -> Programming, Visual Basic and Other Basics -> Visual Basic Tutorials
View previous topic Tell A FriendPrintable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 6 Posts ]
Jump to:   


Style:  
Search: