Bineesh  Viswanath

Bineesh Viswanath

  • NA
  • 1k
  • 780.2k

datagridView1_CellDoubleClick _Event Error

Jul 29 2013 1:34 PM
Sir, I am in a ADO.NET Project.

There are two forms in my project.

My error  in datagridView1_CellDoublClick_Event

I have not problem in loading the form frmPurchaseDetails. Here is the form:-





You can see the productName is filled in the datagridView1 comboBox column. This form is now expecting the SAVE FUCNTION.


Here is another form named frmRegister:-





This is the form where I function datagridView_CellDoubleClick Event.

The Task is : when I double click in the cell, it goes to the frmPurchaseDetails with Data. My task is Update.

lets' see the frmPurchase after the datagridView_CellDoubleClick Event:-




You can see the data from frmRegister is been came in this form. This process  not need the columns in dataGridview to be filled. 

We select a prodcuctName,rate,qty discount and Total. Then the Update to be function.

But take a look to the columns in datagridView. It showing some unwanted columns.


Coed of CellDoubleClick Event:-

 private void dgvRegister_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            decimal dt = decimal.Parse(dgvRegister.CurrentRow.Cells[0].Value.ToString());
            frmPurchase frm = new frmPurchase();
            frm.Show();
            frm.view(dt);
        }


 public void view(decimal mmid)
        {
            decMid = mmid;
            blIsdelete = true;
            blIsprint = true;
            cmbExport.Enabled = true;
            btnGo.Enabled = true;
            btnSave.Text = "Update";
            btnDelete.Enabled = true;
            btnPrint.Enabled = true;
            RegisterSp spRegister = new RegisterSp();
            PurchaseInfo infoPurchase = new PurchaseInfo();
            purchaseSp spPurchase = new purchaseSp();
            dgvPurchaseDetails.DataSource = spRegister.RegisterView(mmid);
            infoPurchase = spPurchase.puchaseDetailsView(mmid);
            txtvoucherNo.Text = infoPurchase.voucherNo.ToString();
            txtpurchaseInvNo.Text = infoPurchase.purchaseinvoiceNo.ToString();
            txtvenderName.Text = infoPurchase.venderName;
            dtpPurchaseDate.Text = infoPurchase.puchaseDate.ToString();
            txtgrandTotal.Text = infoPurchase.grandTotal.ToString();
        }

So I want your suggestion in this code.

Answers (5)