From: dpb on 10 Oct 2009 14:57 xytsrm wrote: > Thanks dpb, > > I thought I had done this in VB along time ago, but it might have been > another language. The VarPtr does allow me to get the reference to the > variables; perhaps there's another undocumented function that would make the > indirect assignment. .... In VB syntax, no. --
From: dpb on 10 Oct 2009 15:07 dpb wrote: > xytsrm wrote: >> Thanks dpb, >> >> I thought I had done this in VB along time ago, but it might have been >> another language. The VarPtr does allow me to get the reference to >> the variables; perhaps there's another undocumented function that >> would make the indirect assignment. > ... > > In VB syntax, no. Even in the one place where there might be a chance the concept of C union didn't make it into UDTs nor did any incarnation of Fortran's EQUIVALENCE --
From: Ralph on 10 Oct 2009 15:35 "xytsrm" <xytsrm(a)discussions.microsoft.com> wrote in message news:44DEDE47-6104-448F-BCFD-C5FEAF8E897D(a)microsoft.com... > Thanks dpb, > > I thought I had done this in VB along time ago, but it might have been > another language. The VarPtr does allow me to get the reference to the > variables; perhaps there's another undocumented function that would make the > indirect assignment. > You can write a function that returns a 'variable' ... Public Function GetStrFromPtr( ByRef addrVar As Long ) As String GetStrFromPtr = addrVar End Function This works by declaring the func param as ByRef, which is the address. However, you will have to define a Function for each Type. Also I didn't mention it as you weren't attempting it, but as you are playing around it is inevitable you'll come across it sooner or later - VarPtr doesn't work for Arrays, but then it kinda does ... <g> VB Arrays are SafeArrays objects, and not a simple contiguous block of memory you might guess. Most of this is an old hat that has been chewed to death. Google/Search for "VB6 SafeArrays VarPtr" for more gory details. It can be good fun and an interesting exercise for an idle weekend if you have yet to go there. But appreciate in the end - you will find no practical use for these functions in VB except for those few scenarios they were initially designed for. -ralph
From: Ralph on 10 Oct 2009 15:51 "dpb" <none(a)non.net> wrote in message news:haqma1$cci$1(a)news.eternal-september.org... > dpb wrote: > > xytsrm wrote: > >> Thanks dpb, > >> > >> I thought I had done this in VB along time ago, but it might have been > >> another language. The VarPtr does allow me to get the reference to > >> the variables; perhaps there's another undocumented function that > >> would make the indirect assignment. > > ... > > > > In VB syntax, no. > > Even in the one place where there might be a chance the concept of C > union didn't make it into UDTs nor did any incarnation of Fortran's > EQUIVALENCE > > -- In VB "unions" are called Variants. <g> -ralph
From: dpb on 10 Oct 2009 16:37
Ralph wrote: > "dpb" <none(a)non.net> wrote in message > news:haqma1$cci$1(a)news.eternal-september.org... >> dpb wrote: >>> xytsrm wrote: >>>> Thanks dpb, >>>> >>>> I thought I had done this in VB along time ago, but it might have been >>>> another language. The VarPtr does allow me to get the reference to >>>> the variables; perhaps there's another undocumented function that >>>> would make the indirect assignment. >>> ... >>> >>> In VB syntax, no. >> Even in the one place where there might be a chance the concept of C >> union didn't make it into UDTs nor did any incarnation of Fortran's >> EQUIVALENCE >> >> -- > > In VB "unions" are called Variants. <g> .... :) But not actually as they don't have multiple symbols, only data-tolerance for the same variable identifier which is what OP was asking for. -- |