int flag = 0;
    int num = 0;
    int price, totprice, qty;
    string product;
    private void ProductsGV_CellContentClick(object sender, DataGridViewCellEventArgs e)
    {
        product = ProductsGV.SelectedRows[0].Cells[1].Value.ToString();
        //qty =  Convert.ToInt32(OrderQtyTb.Text);
        price = Convert.ToInt32(ProductsGV.SelectedRows[0].Cells[3].Value.ToString());
        //totprice = qty * price;
        flag = 1;
    }
    private void button4_Click(object sender, EventArgs e)
    {
        if (OrderQtyTb.Text == "")
            MessageBox.Show("Please Enter Quantity");
        else if (flag == 0)
            MessageBox.Show("Please Select Product");
        else
        {
            num = num + 1;
            qty = Convert.ToInt32(OrderQtyTb.Text);
            totprice = qty * price;
            DataTable table = OrdersGV.DataSource as DataTable;
            table.Rows.Add(num, product, qty, price, totprice);
            flag = 0;
        }
    }
Please help me to fix the error. The error is on the line code table.Rows.Add(num, product, qty, price, totprice);. I just want to add the data in a data grid where i will input number of quantity of a product and then select a product among the product list table then lastly i will confirm.
