Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

edit database from datagridview with right click on data c#

this.MyDataGridView.MouseDown += new System.Windows.Forms.MouseEventHandler(this.MyDataGridView_MouseDown);
this.DeleteRow.Click += new System.EventHandler(this.DeleteRow_Click);
Comment

edit database from datagridview with right click on data c#

private void MyDataGridView_MouseDown(object sender, MouseEventArgs e)
{
    if(e.Button == MouseButtons.Right)
    {
        var hti = MyDataGridView.HitTest(e.X, e.Y);
        MyDataGridView.ClearSelection();
        MyDataGridView.Rows[hti.RowIndex].Selected = true;
    }
}

private void DeleteRow_Click(object sender, EventArgs e)
{
    Int32 rowToDelete = MyDataGridView.Rows.GetFirstRow(DataGridViewElementStates.Selected);
    MyDataGridView.Rows.RemoveAt(rowToDelete);
    MyDataGridView.ClearSelection();
}
Comment

PREVIOUS NEXT
Code Example
Csharp :: drop column with code first asp.net core 
Csharp :: C# milisecond to h m s 
Csharp :: prevent C# app from lingering after closing in background processes 
Csharp :: [range(typeof(bool),"true","true", 
Csharp :: Running C# Example 
Csharp :: c# name script 
Csharp :: c sharp right rotation 
Csharp :: upload file add more size webconfig in asp.net mvc 
Csharp :: c# iterate and pop all elements in stack 
Csharp :: jtoken null or exists c# 
Csharp :: epplus how to align text to right 
Csharp :: C# Relational Operators 
Csharp :: get path c# application 
Csharp :: ${1##*[! ]} 
Csharp :: how to call void unity 
Csharp :: entity framework get all 
Csharp :: c# use meditor from service 
Csharp :: select startup item visual studio 2019 
Csharp :: set windows theme in c# 
Csharp :: c# single comment 
Csharp :: Focus on last entry in listbox 
Csharp :: push vaiable in array c# 
Csharp :: custom player spawner mirror 
Csharp :: c# dictionary key set 
Csharp :: unity download image from online 
Csharp :: 403 forbidden error using Windows Forms 
Csharp :: c# return propertty from each object in object lpist 
Csharp :: c# object list contains object returns incorrect boolean 
Csharp :: trimend c# 
Csharp :: permutation and combination program in c# 
ADD CONTENT
Topic
Content
Source link
Name
4+1 =