Simon,
First, create a base form which will expose the data
sets/tables/adapters which you added to the form through the designer. Make
sure the accessibility of those members is public or protected.
Then, in the constructor of that form, assign the local field references
to the ones that you expose in your static class. Make sure this is done
after InitializeComponent call.
Of course, there is going to be some overhead because the call to
InitializeComponent is going to create the instances of these fields. If
you are trying to eliminate that overhead (which shouldn't be much to begin
with), then this won't work, but the assumption is that you have some
configuration that you want to share.
Then, derive your forms from that base form.
--
- Nicholas Paldino [.NET/C# MVP]
-
(E-Mail Removed)
"navilon" <(E-Mail Removed)> wrote in message
news:3f256b8f-a522-42c2-bc4f-(E-Mail Removed)...
> In my project I have several different forms that need access to the
> same datasets, table adapters and binding sources. I have created a
> static class called 'Globals.cs' which contains one of each. The
> problem is that none of my forms recognize them. It's as if it will
> only see instances within its own class.
>
> Maybe I'm going about this the wrong way, it just seems redundant to
> have every form have an instance of a dataset, table adapter and
> binding source. Any information would be much appreciated.
>
> Thanks,
> Simon