I have database with two tables what i would like to do is in the sales table when i put data in the datagrid is to have a column expression that calculates the quantity * price that gives the total.I am using C# express edition2005 and SQL server express edition 2005 hope someone can help with code and where to place it. Thankyou

Column Expression
Flores
Hi Common Genius I looked at that info and other stuff on microsoft site and other posts I must be doing something wrong i tried the code in the site you said and i can not get it to work . I don't know if it makes any differance that my datagridveiw is bound to a dataset or not if you could give me any further advice it would be very thankfull Thankyou Barry
CurtTampa
Kingsonal
calloatti
Hi Common Genius here is the code
namespace MyApp
{
public partial class Form2 : form
{
public Form2()
{
InitializeComponent();
}
private void Form2_Load(object sender, EventArgs e)
{
this.salesTableAdapter.Fill (this.database1DataSet.Sales);
}
private void CalcColumns()
{
DataTable table = new DataTable();
DataColumn totalColumn = new DataColumn();
totalColumn. DataType = System.Type.GetType("System Decimal");
totalColumn.ColumnName = "Total";
totalColumn.Expression = "Quantity * Price";
table.Columns.Add(totalColumn);
DataRow.row = table. NewRow();
table.Rows.Add(row);
DataView view = new DataView(table);
dataGridView1 . DataSource = view;
}
}
I don't know what i am doing wrong hope you can help after seeing the code i used thanks Barry
Igor Siticov
neilchan
HappyCow