Wrox Home  
Search P2P Archive for: Go

  Return to Index  

pro_vb thread: Strings and variant


Message #1 by "Kumar, Pankaj" <Kumarpa@t...> on Wed, 16 Jan 2002 05:46:39 -0500
  Thanks Randy for your time.
   I did some experiment, got it working finally.
   by default any numeric value changed to variant inside subroutine
   wxception were string and array since they use pointers so they required
   explicit conversion inside vb subroutine

-----Original Message-----
From: Randy Cornish [mailto:rlcornish@c...]
Sent: Saturday, January 19, 2002 8:43 AM
To: professional vb
Subject: [pro_vb] Re: Strings and variant


I had a hard time following the example, so I may be off base here, but 
the short of the matter is - ByRef parameters need to ahve the same EXACT 
datatype.  There is no type coercion when using ByRef.  Therefore, in 
example 2, you are mixing a String and a Variant.  VB won't allow unless 
it is ByVal.

>   I need to return(byref) string type from vbsubroutine from Vb dll.
>   
> 1) works
> 
>   Private Declare Sub ETBORE Lib "EtolTabl.dll" (ByRef TolHi As
> Single,...,..)
> 
>   Public Sub vbETBORE(ByRef TolHi,...,..)
> 	Call ETBORE(TolHi,...,..)
>   End Sub
> 
>    Above sample works but only when argument is string type it gives 
type
> mismatch.
> 
>  
> 2) fail to work
> 
>   Private Declare Sub getc0 lib "round.dll" (ByRef cone_type As
> String,...,..)
> 
> 	Public Sub vbGetConeId(byref cone_type,...,..)
> 	   Call getconeid(cone_type,...,..)  //Type mismatch
> 	End Sub
> 
>   Does VB variant handles string differently than other datatypes.
>  



**********************************************************************
This message and any attachments are intended for the 
individual or entity named above. If you are not the intended
recipient, please do not read, copy, use or disclose this 
communication to others; also please notify the sender by 
replying to this message, and then delete it from your system. 

The Timken Company
**********************************************************************

  Return to Index