Passing a variable parameter to a function 
Author Message
 Passing a variable parameter to a function

I am working with VB 5.0. I would like to create a fuction to which I pass
a user defined type (udt). That udt will then be transformed into a byte
array or string and that string will be sent to another computer using TCP
and  the Winsock control.

My challenge is that I would like to pass different udt's to this same
function without converting them to byte arrays or strings first.  Is this
possible? Any
ideas?

Thanks.

Tom Clarke



Tue, 08 Aug 2000 03:00:00 GMT  
 Passing a variable parameter to a function

Quote:
>My challenge is that I would like to pass different udt's to this same
>function without converting them to byte arrays or strings first.  Is this
>possible? Any
>ideas?

Stream of consciousness starting...

I'm not sure if there's any way to do this.  You can't overload functions in
VB.  You can't declare an argument as a variant and pass it a UDT.

But....

You should be able declare each UDT as a class and then declare your
function to take an Object.  Better yet, have each class (UDT) implement the
same interface - one of your interface members would be a function that
returned a copy of itself, but in a byte array or string.  Alternatively
(but similarly), you could do away with the classes and interfaces and just
define a function for each UDT that would return the UDT as a byte array or
string.

Andrew



Tue, 08 Aug 2000 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Global Variable passed to Parameter

2. Passing a variable as the parameter for a query

3. Passing a Variable Parameter

4. Passing a variable type parameter to an .asp file

5. Passing variables/parameters between forms - newbie question

6. Passing variable value as parameter

7. Passing a variable from VB.NET to a Crystal report parameter or formula with no prompt

8. Passing parameter field variable to report

9. Passing variables to query parameters

10. Passing parameters to a DMax function

11. Question on passing array parameters to VB.NET Sub/Function

12. Passing a form as a parameter into function

 

 
Powered by phpBB® Forum Software