DataView Question

  • Thread starter Thread starter James
  • Start date Start date
J

James

code:

public void Initialize(short [] A1, string [] A2,short [] A3, short []
A4, short [] A5, short RecNo)
{


DataTable myTable = new DataTable("myTable");

DataColumn colItem0 = new
DataColumn("aaa",Type.GetType("System.String"));
myTable.Columns.Add(colItem0);

DataColumn colItem1 = new
DataColumn("bbb",Type.GetType("System.String"));
myTable.Columns.Add(colItem1);

DataColumn colItem2 = new
DataColumn("ccc",Type.GetType("System.String"));
myTable.Columns.Add(colItem2);

DataColumn colItem3 = new
DataColumn("ddd",Type.GetType("System.String"));
myTable.Columns.Add(colItem3);

DataColumn colItem4 = new
DataColumn("eee",Type.GetType("System.String"));
myTable.Columns.Add(colItem4);


DataRow NewRow;

for(int i = 0; i < RecNo; i++)
{
NewRow = myTable.NewRow();

NewRow["aaa"] = AreaNoArray;
NewRow["bbb"] = AreaNameArray;
NewRow["ccc"] = NoOfJobsArray;
NewRow["ddd"] = NoOfCarsArray;
NewRow["eee"] = NoOfEngagedArray;

myTable.Rows.Add(NewRow);
}

myTable.AcceptChanges();

DatView dv = new DataView(myTable);

dataGrid1.DataSource = dv;

}


MY PROBELM:

1. How do I set the column width for each field.
2. How do I change colour of each field.


Thank you in adavance
 
Back
Top