Hi folks,
I am creating a Visual Basic application that uses 4 forms. I have a
list of data(2 types of cities) that I am storing into 2 arrays. Now
the contents of this array need to be shared across multiple forms.
I have two problems:
1) I tried to create a Public array in the Gen. Declaration section of
one of the forms, but it shouts a compile error and asks me not to make
arrays public. I really need the array data to be shared between
forms!! Which is the best place to put all the public variables.
2) I initially wanted to have a structure like this
Type CityInfo
CityName as String 'Atlanta
TicketCost as Integer ' 136.43
End Type
and kept in the Module(.BAS file). When I tried to declare a public
variable in a form, it shouted out an error.
Any suggestions to overcome?
Thanks,
Cricket
[Newbie to VB]
Frank Adam - 28 May 2005 02:53 GMT
>1) I tried to create a Public array in the Gen. Declaration section of
>2) I initially wanted to have a structure like this
>
>Type CityInfo
>CityName as String 'Atlanta
>TicketCost as Integer ' 136.43
>End Type
Right. You can not declare those in an *object* module as Public.
Classes and Forms are object modules.
If you want to share the data between the Forms, create a standard bas
module. In there you can then create your 'Public' types and arrays
and all forms will be able to access them.

Signature
Regards, Frank
Martin Trump - 28 May 2005 12:56 GMT
>TicketCost as Integer ' 136.43
That looks strange to me.
Regards

Signature
Martin Trump
marks542004@yahoo.com - 28 May 2005 16:25 GMT
> >TicketCost as Integer ' 136.43
>
[quoted text clipped - 3 lines]
> --
> Martin Trump
It's probably the rarely seen fractional integer data type. ;)