- Upvotes Received
- 2
- Posts with Upvotes
- 2
- Upvoting Members
- 2
- Downvotes Received
- 0
- Posts with Downvotes
- 0
- Downvoting Members
- 0
3 Posted Topics
Re: You can do it in a simple way, that is right click on gridview then a popup menu will appear and delete the row. Here is the code sample.. if (e.Button == MouseButtons.Right) { this.dataGridView1.Rows[e.RowIndex].Selected = true; this.rowIndex = e.RowIndex; this.dataGridView1.CurrentCell = this.dataGridView1.Rows[e.RowIndex].Cells[1]; this.contextMenuStrip1.Show(this.dataGridView1, e.Location); contextMenuStrip1.Show(Cursor.Position); } Full Source code...[Datagridview … | |
Re: try this code.. connetionString = "Data Source=ServerName;Initial Catalog=DatabaseName;User ID=UserName;Password=Password" cnn = new SqlConnection(connetionString); try { cnn.Open(); MessageBox.Show ("Connection Open ! "); cnn.Close(); } catch (Exception ex) { MessageBox.Show("Can not open connection ! "); } Source...[SQL Server Connection](http://csharp.net-informations.com/data-providers/csharp-sql-server-connection.htm) Watson | |
Re: Datagridview right click and delete row... private void dataGridView1_CellMouseUp(object sender, DataGridViewCellMouseEventArgs e) { if (e.Button == MouseButtons.Right) { this.dataGridView1.Rows[e.RowIndex].Selected = true; this.rowIndex = e.RowIndex; this.dataGridView1.CurrentCell = this.dataGridView1.Rows[e.RowIndex].Cells[1]; this.contextMenuStrip1.Show(this.dataGridView1, e.Location); contextMenuStrip1.Show(Cursor.Position); } } Source...[Right click and delete from datagridview](http://csharp.net-informations.com/datagridview/deletegridview.htm) watson |
The End.