PC Review


Reply
Thread Tools Rating: Thread Rating: 3 votes, 5.00 average.

How to pass a structure to a form subroutine

 
 
Young
Guest
Posts: n/a
 
      5th May 2009
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
 
Reply With Quote
 
 
 
 
matt@djmatty.com
Guest
Posts: n/a
 
      5th May 2009
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

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


 
Reply With Quote
 
 
 
 
Cor Ligthert[MVP]
Guest
Posts: n/a
 
      5th May 2009
Young,

Do you have some documentation about the syntax you use here,

I never saw it, and therefore I am curious how to use this

I know the Text property as the property that shows the name of a form, it
is simple a String, I don't know it as an array, type or collection.

Form1.Text(mmm)

Cor


 
Reply With Quote
 
Young
Guest
Posts: n/a
 
      5th Jun 2009
Thanks.
<(E-Mail Removed)> wrote in message
news:2fede44a-364a-4c29-9055-(E-Mail Removed)...
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

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



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to pass a structure to a form subroutine Young Microsoft Dot NET Framework Forms 3 5th Jun 2009 02:14 AM
How to pass a structure to a form subroutine Young Microsoft Dot NET 3 5th Jun 2009 02:14 AM
How to pass a structure to a form subroutine Young Microsoft VB .NET 8 5th Jun 2009 02:14 AM
Re: Subroutine within a Subroutine Alex K. Angelopoulos [MVP] Microsoft VB .NET 1 20th Jan 2004 07:39 PM
How to pass a subroutine as a parameter to another subroutine? Richard Microsoft VB .NET 2 15th Jan 2004 08:52 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:16 AM.