Baily

Baily

  • NA
  • 22
  • 0

Classes

Dec 19 2009 8:03 PM

L.S.,
For my program I've to update a file. This can be done at two ways:
1. You load the last file and update it.
2. You start with a MT file and start from scratch.
I want to do the last, but my MT file consists of 50 "category" records, which have to be loaded in the array. 
Because of the destructor I'm not able to do this within a Method. The data records will be destroyed and the end of the Method.
How can I achieve this?
 ItemRec.cs
namespace Stores
{ class ItemRec
   { public int index;
     public string descr;
     public double price;
     //Constructor
     public ItemRec(int c_index, string c_descr, double c_price)
     { index = c_index:
       descr = c_descr;
       price = c_price; }
     public int my_index { get {return index;} set {index = value;}}
     public string my_descr { get {return descrt;} set {descr = value;}}
     public double my_price {get {return price;} set {price = value;}}          
 
 
  Program.cs
List<Stores.ItemRec> ItemRecN = new List<Stores.ItemRec>();
Application.Run (new Form1()); 

 
 Form1.cs
public partial class Form1: Form
{ list<Stores.ItemRec> ItemRecN = new <Stores.ItemRec>();
]
public Form1()
{}
private void FileNew_Click(......................)
{  ItemRecN.Add(new Stores.ItemRec(0,"Stationary", 0.00));
   ItemRecN.Add(new Stores.Itemrec(1,"Books     ", 0.00));
   etc.
   etc.   
}

 
Thanks and Regards,
 
Baily

Answers (3)