private void getAllBooks() { dtProduct = ConvertToDataTable(bm.GetProductList()); dtProduct.PrimaryKey = new DataColumn[] { dtProduct.Columns["AlbumID"] }; //DataColumn subTotal= dtProduct.Columns.Add("SubTotal", typeof(double), "Quantity*UnitPrice"); //subTotal.ReadOnly = false; //DataColumn column = dtProduct.Columns.Add("Total"); //column.DataType = System.Type.GetType("System.Decimal"); //column.ReadOnly = true; //column.Expression = "UnitPrice * Quantity"; //column.Unique = false; txtId.DataBindings.Clear(); txtName.DataBindings.Clear(); txtYear.DataBindings.Clear(); txtQuantity.DataBindings.Clear(); txtStatus.DataBindings.Clear(); txtId.DataBindings.Add("Text", dtProduct, "AlbumID"); txtName.DataBindings.Add("Text", dtProduct, "AlbumName"); txtYear.DataBindings.Add("Text", dtProduct, "ReleaseYear"); txtQuantity.DataBindings.Add("Text", dtProduct, "Quantity"); txtStatus.DataBindings.Add("Text", dtProduct, "Status"); txtId.Enabled = false; txtName.Enabled = false; txtYear.Enabled = false; txtQuantity.Enabled = false; txtStatus.Enabled = false; dgvProductList.DataSource = dtProduct; }