Click here to Skip to main content
15,926,959 members
Home / Discussions / C#
   

C#

 
GeneralRe: Pretty Weird Request Here... Pin
ABean19-Jun-04 6:11
ABean19-Jun-04 6:11 
GeneralRe: Pretty Weird Request Here... Pin
Heath Stewart19-Jun-04 8:25
protectorHeath Stewart19-Jun-04 8:25 
GeneralRe: Pretty Weird Request Here... Pin
leppie19-Jun-04 5:42
leppie19-Jun-04 5:42 
GeneralRe: Pretty Weird Request Here... Pin
Heath Stewart19-Jun-04 8:27
protectorHeath Stewart19-Jun-04 8:27 
GeneralRe: Pretty Weird Request Here... Pin
matthias s.19-Jun-04 23:37
matthias s.19-Jun-04 23:37 
GeneralRe: Pretty Weird Request Here... Pin
Heath Stewart20-Jun-04 10:00
protectorHeath Stewart20-Jun-04 10:00 
Generalsharing object placed on a form, in all other forms. Pin
Member 114126619-Jun-04 5:02
Member 114126619-Jun-04 5:02 
GeneralRe: sharing object placed on a form, in all other forms. Pin
Heath Stewart19-Jun-04 8:19
protectorHeath Stewart19-Jun-04 8:19 
Then expose your DataSet and DataAdapter as public or internal properties on your form and access them from your child controls or from other forms:
MainForm form = this.Parent as MainForm;
if (form != null)
{
  // DataAdapter and DataSource properties defined on MainForm...
  form.DataAdapter.Fill(form.DataSource);
}
If you want to access these from other forms, then make sure those forms have a reference to the form instance that declares the DataSet and DataAdapter and that those fields or properties (properties are recommended since they give you more control via encapsulation) are accessible (public or internal, or protected if a form derives from the form that has those properties or fields).

It's all a simple matter of object-oriented programming. Expose objects with member accessibility that provides other objects access to what they need and denies access to what they shouldn't have.

 

Microsoft MVP, Visual C#
My Articles
GeneralRe: sharing object placed on a form, in all other forms. Pin
Member 114126620-Jun-04 1:02
Member 114126620-Jun-04 1:02 
Generalsaving collection automaticaly into form`s code file.(or resource) Pin
Member 114126619-Jun-04 4:52
Member 114126619-Jun-04 4:52 
GeneralRe: saving collection automaticaly into form`s code file.(or resource) Pin
Heath Stewart19-Jun-04 8:15
protectorHeath Stewart19-Jun-04 8:15 
Generaldatatable in class, XMLserialization Pin
Member 114126619-Jun-04 4:50
Member 114126619-Jun-04 4:50 
GeneralRe: datatable in class, XMLserialization Pin
Heath Stewart19-Jun-04 8:13
protectorHeath Stewart19-Jun-04 8:13 
GeneralRe: datatable in class, XMLserialization Pin
Member 114126619-Jun-04 23:22
Member 114126619-Jun-04 23:22 
GeneralRe: datatable in class, XMLserialization Pin
Heath Stewart20-Jun-04 9:57
protectorHeath Stewart20-Jun-04 9:57 
QuestionCalling the default ctor from an overloaded ctor? Pin
matthias s.19-Jun-04 3:38
matthias s.19-Jun-04 3:38 
AnswerRe: Calling the default ctor from an overloaded ctor? Pin
leppie19-Jun-04 4:20
leppie19-Jun-04 4:20 
GeneralRe: Calling the default ctor from an overloaded ctor? Pin
matthias s.19-Jun-04 5:12
matthias s.19-Jun-04 5:12 
AnswerRe: Calling the default ctor from an overloaded ctor? Pin
Nick Parker19-Jun-04 4:32
protectorNick Parker19-Jun-04 4:32 
GeneralRe: Calling the default ctor from an overloaded ctor? Pin
matthias s.19-Jun-04 5:14
matthias s.19-Jun-04 5:14 
AnswerRe: Calling the default ctor from an overloaded ctor? Pin
Colin Angus Mackay19-Jun-04 4:41
Colin Angus Mackay19-Jun-04 4:41 
GeneralRe: Calling the default ctor from an overloaded ctor? Pin
Nick Parker19-Jun-04 4:47
protectorNick Parker19-Jun-04 4:47 
GeneralRe: Calling the default ctor from an overloaded ctor? Pin
Colin Angus Mackay19-Jun-04 5:07
Colin Angus Mackay19-Jun-04 5:07 
GeneralRe: Calling the default ctor from an overloaded ctor? Pin
Nick Parker19-Jun-04 5:37
protectorNick Parker19-Jun-04 5:37 
GeneralRe: Calling the default ctor from an overloaded ctor? Pin
matthias s.19-Jun-04 5:10
matthias s.19-Jun-04 5:10 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.