Click here to Skip to main content
15,920,110 members
Home / Discussions / C#
   

C#

 
AnswerRe: Using LINQ with a ASP application Pin
Not Active23-May-08 2:42
mentorNot Active23-May-08 2:42 
GeneralRe: Using LINQ with a ASP application Pin
Steve Holdorf23-May-08 3:08
Steve Holdorf23-May-08 3:08 
GeneralRe: Using LINQ with a ASP application Pin
Not Active23-May-08 3:16
mentorNot Active23-May-08 3:16 
Questioncannot convert char* to object or string? Pin
cristi_alonso23-May-08 1:41
cristi_alonso23-May-08 1:41 
AnswerRe: cannot convert char* to object or string? Pin
DaveyM6923-May-08 1:55
professionalDaveyM6923-May-08 1:55 
AnswerRe: cannot convert char* to object or string? Pin
leppie23-May-08 8:49
leppie23-May-08 8:49 
QuestionAccessing an ArrayList from a sub-form Pin
Dirk.Bock23-May-08 0:27
Dirk.Bock23-May-08 0:27 
AnswerRe: Accessing an ArrayList from a sub-form Pin
Phil J Pearson23-May-08 0:51
Phil J Pearson23-May-08 0:51 
Your problem is that myList is a member of the class MSCMain so your sub-form needs a reference to MSCMain in order to access it. There are broadly two approaches, each with variations.

1) If you really only want to have one instance of myList you can make it static. (It would be best if the list were a private member of MSCMain with a public accessor property.) eg:
// in MSCMain
// ...
private static ArrayList myList = blaah blaah;

public static ArrayList MStatList
  {
  get { return myList; }
  }

// and in the sub-form ...
// ...
  MSCMain.MStatList.Add(theNewMStat);
// ...



2) If you want to keep myList an instance member you need to pass your sub-form a reference either to myList or to the instance of MSCMain (which it can use to access the list). eg, in MSCMain somewhere:
SubForm subForm = new SubForm(myList);

and in SubForm:
// ...
private ArrayList list;
// ...
public SubForm(ArrayList aList)
  {
  list = aList;
  // ...
  }

// and in the OK button handler
// ...
  list.Add(theNewMStat);
// ...


Phil



The opinions expressed in this post are not necessarily those of the author, especially if you find them impolite, inaccurate or inflammatory.

AnswerRe: Accessing an ArrayList from a sub-form Pin
DaveyM6923-May-08 1:28
professionalDaveyM6923-May-08 1:28 
QuestionUsing NUnit to test class which uses external XML file. Pin
N a v a n e e t h23-May-08 0:01
N a v a n e e t h23-May-08 0:01 
AnswerRe: Using NUnit to test class which uses external XML file. Pin
Colin Angus Mackay23-May-08 0:13
Colin Angus Mackay23-May-08 0:13 
GeneralRe: Using NUnit to test class which uses external XML file. Pin
N a v a n e e t h23-May-08 0:57
N a v a n e e t h23-May-08 0:57 
GeneralRe: Using NUnit to test class which uses external XML file. Pin
Colin Angus Mackay23-May-08 4:11
Colin Angus Mackay23-May-08 4:11 
QuestionProblem in ReportDocument.Export() function. [modified] Pin
Nitten22-May-08 23:55
Nitten22-May-08 23:55 
QuestionDictionary. Can anyone spot whats going on here? Pin
MarkB77722-May-08 22:41
MarkB77722-May-08 22:41 
AnswerRe: Dictionary. Can anyone spot whats going on here? Pin
Giorgi Dalakishvili22-May-08 22:47
mentorGiorgi Dalakishvili22-May-08 22:47 
GeneralRe: Dictionary. Can anyone spot whats going on here? Pin
MarkB77723-May-08 0:00
MarkB77723-May-08 0:00 
GeneralRe: Dictionary. Can anyone spot whats going on here? Pin
Giorgi Dalakishvili23-May-08 7:02
mentorGiorgi Dalakishvili23-May-08 7:02 
AnswerRe: Dictionary. Can anyone spot whats going on here? Pin
The Nightcoder23-May-08 15:26
The Nightcoder23-May-08 15:26 
GeneralRe: Dictionary. Can anyone spot whats going on here? Pin
MarkB77723-May-08 16:17
MarkB77723-May-08 16:17 
GeneralRe: Dictionary. Can anyone spot whats going on here? Pin
The Nightcoder23-May-08 16:29
The Nightcoder23-May-08 16:29 
QuestionHow to bind property to control (through this[string]) Pin
El'Cachubrey22-May-08 22:33
El'Cachubrey22-May-08 22:33 
AnswerRe: How to bind property to control (through this[string]) Pin
darkelv22-May-08 23:00
darkelv22-May-08 23:00 
GeneralRe: How to bind property to control (through this[string]) Pin
El'Cachubrey22-May-08 23:05
El'Cachubrey22-May-08 23:05 
GeneralRe: How to bind property to control (through this[string]) Pin
darkelv23-May-08 0:00
darkelv23-May-08 0:00 

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.