private void Add_Items() { if (!isColumnCreated) { Purchase_data.Columns.Add("Item Number"); Purchase_data.Columns.Add("Item Name"); Purchase_data.Columns.Add("Quantity"); Purchase_data.Columns.Add("Price"); Purchase_data.Columns.Add("Total Price"); isColumnCreated = true; } double x, y, z, sum; x = Convert.ToDouble(iQtytxt.Text); y = Convert.ToDouble(iPrice); z = Convert.ToDouble(iPricetxt.Text); sum = (x * y) + z; iPricetxt.Text = Math.Round(sum, 2).ToString(); Purchase_data.Rows.Add(iNumbertxt.Text, iName, iQtytxt.Text, iPrice, Math.Round((x * y), 2).ToString()); DisplayData.DataSource = Purchase_data; DisplayData.AutoResizeColumns(); DisplayData.AutoResizeRows(); iNumbertxt.Text = ""; iQtytxt.Text = ""; }