Unable to pass an object
- From: Lilith <lilith@xxxxxxxxx>
- Date: Thu, 16 Aug 2007 16:18:49 -0500
I have a form that invokes two other dialog forms for controlling the
configuration of the program. The dialogs are invoked modally. Rather
than pile up a large number of variables in the primary form I created
a class to hold the configuration data, validate it, save it. etc. An
object of this class is in the main form. The data is all private but
I have public accessors for all of it. My need is to make it
availlable to the two sub-forms when I call them but no matter my
method of approach I get stymied in the compile with a variety of
errors, depending on the methodology I'm trying.
I've make the object public, private and tried to pass it to a newly
constructed form via a public method in the sub-form before showing
the dialog (I'm successful with individual items, but not the class
object.) When I make it private, it's not available in the context of
the sub-form. This I can understand. When I make it public and try
to pass it via a function I get an error along the lines of
Inconsistent accessibility: parameter type 'GWIAmon.AllCfg' is less
accessible than method 'GWIAmon.Config.SetCfg(GWIAmon.AllCfg)
I think what I'm seeing from searches is that the object has to be of
a public class, though I'm not sure what that means.
Any help would be appreciated. Right now the code is looking awfully
ugly and since I need to do this in at least two places, I'd like to
make sure that I'm not dropping data by passing member data one at a
time.
On this same note, if I do
form2.ShowDialog(this);
Where is "this" represented in form2 to such that I might have acces
to it? Or is this solely for the benefit of the form to know what
owns it?
--
Thanks,
Lilith
.
- Follow-Ups:
- Re: Unable to pass an object
- From: Peter Duniho
- Re: Unable to pass an object
- Prev by Date: Re: how to define a variable of a type that is in a string
- Next by Date: Re: Something I'd like to see in C#
- Previous by thread: how to define a variable of a type that is in a string
- Next by thread: Re: Unable to pass an object
- Index(es):
Relevant Pages
|