Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

c# datagridview multiple row selection without control

    private List<int> SelectedIndexs { get; set; }
	private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
    {
        if (SelectedIndexs.Contains(e.RowIndex))
        {
            SelectedIndexs.Remove(e.RowIndex);
        }
        else
        {
            SelectedIndexs.Add(e.RowIndex);
        }

        foreach (DataGridViewRow row in this.dataGridView1.Rows)
        {
            row.Selected = SelectedIndexs.Contains(row.Index);
        }
    }
Comment

PREVIOUS NEXT
Code Example
Csharp :: how to find the biggest number in c# 
Csharp :: wpf binding ancestor codebehind 
Csharp :: unity audiosource play 
Csharp :: unity change fixed timestep in code 
Csharp :: recorrer list c# 
Csharp :: how to we put a link in button in a view in asp.net 
Csharp :: unity vector3 initialization 
Csharp :: How to change ListBox selection background color 
Csharp :: encode pdf file to base64 c# 
Csharp :: convert from data adapter to Ienumerable C# 
Csharp :: how prevent user remove file linux 
Csharp :: check if list contains any empty element in c# 
Csharp :: method c# 
Csharp :: autoit console write 
Csharp :: convert rgb to float 
Csharp :: dotnet add package 
Csharp :: c# return two values 
Csharp :: is narcissistic number 
Csharp :: c# console.writeline 
Csharp :: implicit vs explicit cast c# 
Csharp :: c# nunit test case 
Csharp :: Proxy in Config 
Csharp :: one line condition c# 
Csharp :: muovere un elemento in c# 
Csharp :: for loop c# to print times tables 
Csharp :: index list c# 
Csharp :: erewt 
Csharp :: user (current login user) in viewcomponent 
Csharp :: ASP.NET C# Catch all exceptions in a class 
Csharp :: How to change color of a column in RDLC report 
ADD CONTENT
Topic
Content
Source link
Name
5+1 =