T
Tony
Hello!
I can't see any use of the property Caption in the DataColumn class because
you can't change the column title by using that property.
Here I have a short code snippet where I change the Caption on the third
added column to Limit but if I look at the
DataTable its still show the column title as CreditLimit so setting the
Caption has no effect.
I hope someone can correct me if I'm wrong about this caption property on
the DataColum class.
private void CreateDataTable()
{
DataTable table;
DataColumn column;
table = new DataTable("Customers");
//CustomerID column
column = table.Columns.Add("CustomerID",
System.Type.GetType("System.Int32"));
column.Unique = true;
//CustomerName column
column = table.Columns.Add("CustomerName",
System.Type.GetType("System.String"));
column.Caption = "Name";
//CreditLimit
column = table.Columns.Add("CreditLimit",
System.Type.GetType("System.Double"));
column.DefaultValue = 0;
column.Caption = "Limit";
table.Rows.Add(new object[] { 1, "Jonathan", 23.44 });
table.Rows.Add(new object[] { 2, "Bill", 56.87 });
}
//Tony
I can't see any use of the property Caption in the DataColumn class because
you can't change the column title by using that property.
Here I have a short code snippet where I change the Caption on the third
added column to Limit but if I look at the
DataTable its still show the column title as CreditLimit so setting the
Caption has no effect.
I hope someone can correct me if I'm wrong about this caption property on
the DataColum class.
private void CreateDataTable()
{
DataTable table;
DataColumn column;
table = new DataTable("Customers");
//CustomerID column
column = table.Columns.Add("CustomerID",
System.Type.GetType("System.Int32"));
column.Unique = true;
//CustomerName column
column = table.Columns.Add("CustomerName",
System.Type.GetType("System.String"));
column.Caption = "Name";
//CreditLimit
column = table.Columns.Add("CreditLimit",
System.Type.GetType("System.Double"));
column.DefaultValue = 0;
column.Caption = "Limit";
table.Rows.Add(new object[] { 1, "Jonathan", 23.44 });
table.Rows.Add(new object[] { 2, "Bill", 56.87 });
}
//Tony