Click here to Skip to main content
15,896,201 members
Home / Discussions / C#
   

C#

 
GeneralRe: own Printer service on c#.net Pin
vikas amin19-Aug-08 5:41
vikas amin19-Aug-08 5:41 
QuestionArrayList ....Where is problem? Pin
zeeShan anSari30-Jul-08 6:30
zeeShan anSari30-Jul-08 6:30 
AnswerRe: ArrayList ....Where is problem? Pin
Wendelius30-Jul-08 6:44
mentorWendelius30-Jul-08 6:44 
GeneralRe: ArrayList ....Where is problem? Pin
zeeShan anSari30-Jul-08 6:52
zeeShan anSari30-Jul-08 6:52 
QuestionRe: ArrayList ....Where is problem? Pin
Wendelius30-Jul-08 6:54
mentorWendelius30-Jul-08 6:54 
AnswerRe: ArrayList ....Where is problem? Pin
zeeShan anSari30-Jul-08 7:09
zeeShan anSari30-Jul-08 7:09 
GeneralRe: ArrayList ....Where is problem? Pin
Wendelius30-Jul-08 7:22
mentorWendelius30-Jul-08 7:22 
GeneralRe: ArrayList ....Where is problem? Pin
Alaric_30-Jul-08 7:31
professionalAlaric_30-Jul-08 7:31 
Mika beat me to it.

Yeah....applying the static modifier to the properties in your class makes it so that the "Department" class will maintain a SINGLE value for all instances of that class.


if you remove "static" as Mika suggested, you should be able to restructure your code as such to provide the functionality you're requesting:
ArrayList departments= new ArrayList();
Dept department;
while(reader.Read)
{
  department = new Dept();
  department.DName = reader["DepartmentName"] //or whatever name you have given your column
  department.DEPTNO = reader["DepartmentNumber"] //or whatever
  //...
  departments.Add(department);
}


One suggestion, simply from a coding style perspective: Don't abbreviate things that don't need to be abbreviated(unless you have some unknown technical limitation) Your objects are obviously being used for storing Department data, so why is your class not called "Department" ?

Your "DName" property would more appropriately be called "DepartmentName", but then again, with your class already named "Department", why would you need to restate the owner of the name? With a property of "Name", your object interface would be cleaner

department.Name;


"I need build Skynet. Plz send code"

GeneralRe: ArrayList ....Where is problem? Pin
zeeShan anSari30-Jul-08 7:47
zeeShan anSari30-Jul-08 7:47 
GeneralRe: ArrayList ....Where is problem? Pin
Wendelius30-Jul-08 7:58
mentorWendelius30-Jul-08 7:58 
QuestionInvisible Form Labels [modified] Pin
#realJSOP30-Jul-08 6:12
professional#realJSOP30-Jul-08 6:12 
QuestionRe: Invisible Form Labels Pin
Wendelius30-Jul-08 7:07
mentorWendelius30-Jul-08 7:07 
AnswerRe: Invisible Form Labels Pin
#realJSOP30-Jul-08 7:28
professional#realJSOP30-Jul-08 7:28 
GeneralRe: Invisible Form Labels [modified] Pin
Wendelius30-Jul-08 7:39
mentorWendelius30-Jul-08 7:39 
GeneralRe: Invisible Form Labels Pin
#realJSOP30-Jul-08 7:47
professional#realJSOP30-Jul-08 7:47 
GeneralRe: Invisible Form Labels Pin
Wendelius30-Jul-08 8:09
mentorWendelius30-Jul-08 8:09 
AnswerRe: Invisible Form Labels Pin
DaveyM6930-Jul-08 9:35
professionalDaveyM6930-Jul-08 9:35 
GeneralRe: Invisible Form Labels Pin
#realJSOP30-Jul-08 10:43
professional#realJSOP30-Jul-08 10:43 
GeneralRe: Invisible Form Labels Pin
DaveyM6930-Jul-08 11:45
professionalDaveyM6930-Jul-08 11:45 
GeneralRe: Invisible Form Labels Pin
#realJSOP30-Jul-08 12:05
professional#realJSOP30-Jul-08 12:05 
GeneralRe: Invisible Form Labels Pin
#realJSOP31-Jul-08 3:37
professional#realJSOP31-Jul-08 3:37 
QuestionHow to Update MDB file? Pin
Admin88730-Jul-08 5:20
Admin88730-Jul-08 5:20 
AnswerRe: How to Update MDB file? Pin
Yusuf30-Jul-08 5:32
Yusuf30-Jul-08 5:32 
AnswerRe: How to Update MDB file? Pin
ElSpinos30-Jul-08 5:33
ElSpinos30-Jul-08 5:33 
QuestionSlides View Control Pin
breandan30-Jul-08 4:40
breandan30-Jul-08 4:40 

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.