Click here to Skip to main content
15,887,683 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
hello

little help is what I need, as usual

I have this small code in datagridview_ColumnHeaderMouseDoubleClick event
C#
if (datagridview.Columns["Test"].Selected)
            {
                r7.Checked = true;
            }
            else
            {
                r7.Checked = false;
}

and so on and on

where basically I want when I double click column in datagridview I want that column which header I double clicked to turn radio button r7 on, but nothing

anyone
Posted
Updated 7-Jun-13 2:52am
v2
Comments
ZurdoDev 7-Jun-13 8:52am    
So, what happens? Where are you stuck?
Maciej Los 7-Jun-13 9:22am    
WinForms? WebControls? It makes the difference!
Shahin Khorshidnia 10-Jun-13 3:22am    
Please Tag your question. ASP.Net? WinForm? WPF? What?!

C#
if (e.ColumnIndex == datagridview.Columns["Test"].Index)
{
// do smth
}
else
{
// do smth
}
 
Share this answer
 
v2
Try this.

Select the datagridview and go to Events in the properties window.
double click the ColumnHeaderMouseDoubleClick event.
Then in code:


C#
private void dataGridView1_ColumnHeaderMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e)
       {
           r7.checked == true;
               //if you want to know what column is clicked.
              int i= e.ColumnIndex;
       }
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900