Home All Groups Group Topic Archive Search About

How to pass a structure to a form subroutine

Author
5 May 2009 4:42 AM
Young
I've the following structure:

Structure MyStruct
Dim x As String
Dim y As String
End Structure

In one of my form (Form1), I have this sub:

Sub Test(byref XXX as MyStruct)

.......

end sub

I then try to pass in the structure by doing this:

Dim mmm as MyStruct
Form1.Text(mmm)

The above caused an error when in the Sub declaration:

This is the error: XXX cannot expose type MyStruct outside the project through class Form1

Can someone please help?

TIA
Young

Author
5 May 2009 5:11 AM
matt
My first guess is that it's to do with what access you have declared
the struct as. I did cut and paste the error message into google and
it came up with this:

http://msdn.microsoft.com/en-us/library/90htzsex(VS.80).aspx

Try declaring the struct public? (e.g. public structure MyStruct...)

Matt

Show quoteHide quote
On May 5, 2:42 pm, "Young" <young10***@hotmail.com> wrote:
> I've the following structure:
>
> Structure MyStruct
> Dim x As String
> Dim y As String
> End Structure
>
> In one of my form (Form1), I have this sub:
>
> Sub Test(byref XXX as MyStruct)
>
> ......
>
> end sub
>
> I then try to pass in the structure by doing this:
>
> Dim mmm as MyStruct
> Form1.Text(mmm)
>
> The above caused an error when in the Sub declaration:
>
> This is the error: XXX cannot expose type MyStruct outside the project through class Form1
>
> Can someone please help?
>
> TIA
> Young
Author
5 Jun 2009 1:14 AM
Young
Thanks.
<m***@djmatty.com> wrote in message
news:2fede44a-364a-4c29-9055-03b4f8b8f2b2@d2g2000pra.googlegroups.com...
My first guess is that it's to do with what access you have declared
the struct as. I did cut and paste the error message into google and
it came up with this:

http://msdn.microsoft.com/en-us/library/90htzsex(VS.80).aspx

Try declaring the struct public? (e.g. public structure MyStruct...)

Matt

Show quoteHide quote
On May 5, 2:42 pm, "Young" <young10***@hotmail.com> wrote:
> I've the following structure:
>
> Structure MyStruct
> Dim x As String
> Dim y As String
> End Structure
>
> In one of my form (Form1), I have this sub:
>
> Sub Test(byref XXX as MyStruct)
>
> ......
>
> end sub
>
> I then try to pass in the structure by doing this:
>
> Dim mmm as MyStruct
> Form1.Text(mmm)
>
> The above caused an error when in the Sub declaration:
>
> This is the error: XXX cannot expose type MyStruct outside the project
> through class Form1
>
> Can someone please help?
>
> TIA
> Young