Hi Rob,
Thanks for the clue on the string option. I scanned the on-line
code for a method but I must have missed the construtor overloading
capability. Yeah, the ref was a real pain in the A**. Happily, I
built a custom code generator for the C++ side (parsing a DB schema)
so I can quickly change back to the corrected version in the future.

"Rob Teixeira" <RobTeixeira@@msn.com> wrote:
>
>Hi Patrick,
>
>I knew there was a problem in beta 1 with ref types not being updated properly,
>but I thought this was only with Paramarrays. Apperently, you found out

otherwise
>
>I'll have to remember that.
>
>But the point is that it's a known limitation with Beta1, so don't go and
>change all your DLL's right away. The problem should be fixed soon.
>
>Anyway, you no longer need a String() function. The string class has a constructor
>to do what you want:
>MyString = new String (MyChar, 10)
>
>-Rob
>
>"Patrick Ireland" <ireland@airmail.net> wrote:
>>
>>Hi Jeff,
>>
>>Thanks for the timely response. However, I have already tried the
>>structure method:
>>
>>Public Structure <StructLayout(LayoutKind.Sequential)> DATA_TestPassing
>> Public AccessStatus As Integer
>> Public <MarshalAs(UnmanagedType.ByValArray, SizeConst:=20)> UserName()
>>As Byte
>>End Structure
>>
>>VB.NET gives the error message:
>>
>>"Array initializers are not allowed on a field in a structure"
>>
>>So it seems like a Catch-22. Of course I could have the marshal statement
>>incorrect for the array of bytes.
>>
>>Your comment about filling out the array is very appropriate. I found

that
>>I had to fill every position with something and I could not do it by array
>>subscripting. I filled the array with the System.Text.ASCIIEncoding ().
>>
>>I am disappointed it that I can not find a equivalent to the VB6-- function
>>String$(10,Chr(0)) that produces a string of 10 null characters or what
>>ever character is the second argument. Do you know of one?
>>
>>As always, Jeff you have been the horn of plenty for information but
>>sadly this time the suggested feature has a problem. Admittedly, the
>>problem may be between the ears of this typist.
>>
>>"Jeff Peil" <jpeil@bigfoot.com> wrote:
>>>Hi Patrick,
>>>
>>>"Patrick Ireland" <ireland@airmail.net> wrote in message
>>>news:3aa08054$1@news.devx.com...
>>>> The ByVal was selected because if I used ByRef I do not get the data.

>> I
>>>> suspect that I get a pointer to a pointer to the structure data.
>>>
>>>Doh, I completely overlooked that you were using a class and not a
>>>structure. IIRC this is broken for VB.NET in beta 1 because the out
>>>attribute is not properly supported by the compiler (however it does work
>>>for a structure passed byref which will give the same semantics as a class
>>>passed byval in your case.)
>>>
>>>This does work in C# and ME C++* with a managed class for the parameter

>>as
>>>the beta 1 compiler because those languages does support the out attribute
>>>properly.
>>>
>>>* Beta 1 ME C++ does not properly attribute parameters for global methods,
>>>but it will work when used on a static member of a managed type.
>>>
>>>
>>>Anyways try chaning your VB code to
>>>
>>>Public Structure <StructLayout(LayoutKind.Sequential)> DATA_TestPassing
>>> ' AccessStatus INT
>>> Public AccessStatus As Integer
>>> ' UserName CHAR (16)
>>> Public <MarshalAs(UnmanagedType.ByValArray, SizeConst:=20)> UserName()
>>>As Byte
>>>End Structure
>>>
>>>and
>>>
>>>
>>> Private Declare Function AccessTestPassing _
>>> Lib "c:\Pat\VS7\EXE\TestPassing" _
>>> (ByVal intAccessType As Integer, _
>>> ByRef REC_TestPassing As DATA_TestPassing) _
>>> As Integer
>>>
>>>Of course keep in mind that a freshly created DATA_TestPassing will not

>>have
>>>it's array initialized (you'll want to manually initialize the array on

>>the
>>>managed side of things before using it.)
>>>
>>>

>>

>