By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
428,558 Members | 1,533 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 428,558 IT Pros & Developers. It's quick & easy.

To delete a row in access table from datagridView using ContextMenuStrip

P: 4
how to delete the selected row in datagridview using ContextMenuStrip.When i right-click and press "delete" the seleted row in the dataGridView has to be deleted and as well in my access table.I am new to

my coding is this:
Expand|Select|Wrap|Line Numbers
  1.             int curRow = 0;
  2.             curRow = this.dataGridView1.CurrentRow.Index;
  3.             this.dataGridView1.Rows.RemoveAt(curRow);
but it is deleting only in datagridView and it is not getting updated in my access table.plz help me with the code,where i should write my query to delete based on the selected row .plz help me
Jan 24 '09 #1
Share this Question
Share on Google+
2 Replies

P: 1
Hi there !
I got the same problem check out this:
# int curRow = 0;
# curRow = this.dataGridView1.CurrentRow.Index;
# this.dataGridView1.Rows.RemoveAt(curRow);
->this.tableAdapterManager.UpdateAll(this.YourDataS et);<-
Mar 18 '09 #2

P: 1
private void contextMenuStrip1_Click(object sender, EventArgs e)
if (!this.dataGridView1.Rows[this.rowIndex].IsNewRow)

Full source...Delete from datagridview on right click

Jun 3 '14 #3

Post your reply

Sign in to post your reply or Sign up for a free account.