Click here to Skip to main content
15,503,177 members

Comments by _Q12_ (Top 200 by date)

_Q12_ 23-Jun-22 4:37am View    
or not ...
_Q12_ 23-Jun-22 4:20am View    
Hmmm... i dont think is correct. Because you are still in Label_in_MouseClick event. That event is finished after I click on label1 in Form1. After I click on label2 inside the control, "Label_in_MouseClick" event from Form1 is long gone and closed. So we need to split it as I did it. I still wish a more elegant solution than what I find already... the subject remains open until then.
_Q12_ 23-Jun-22 4:09am View    
Thank you, I will try your way now
_Q12_ 18-Nov-21 8:44am View    
I am explaining this problem as simple as possible:
Here is exactly what I do: (and try to do it Exactly as Im doing it,in your side)
step1: I made a new project and added a new datagrid and in it added 10 columns as showing in the picture; also I didnt change any properties of the columns Ive added, I left them by default.[^]

step2: I put a breakpoint in my code, then I run the project and drag column4 in between column1 and column2 as shown in the image. What is interesting that here in runtime, it is showing correctly the order after I drag the columns around. But in code, the index of the columns are randomized. So to be clear, this runtime order is the correct order, and it is 142356789. 4 is indeed in between 1 and 2!!![^]

step3: ListCO is my --DEBUG LIST--. After putting my breakpoint, I can read the entire List content and its order. That is shown in the next image. But the order is not as in runtime, it is 023[1]456789, so 1 jumped in between 3 and 4. WHYYYYYYYY? (It should have been 1[4]2356789) What do I miss? What is the logic behind this column reorder?[^]
As always, thank you !

My entire TesT code here:

public partial class Form1 : Form
public Form1()

List<int> ListCO = new List<int>();
private void dataGridView1_ColumnDisplayIndexChanged(object sender, DataGridViewColumnEventArgs e)
for (int i = 0; i < dataGridView1.Columns.Count; i++)
int debug = 0;

I have tried with:
but indiferent of the runtime column reorder, the list will always show 0123456789,with absolutly no changes.
_Q12_ 18-Nov-21 8:16am View