I am pretty new to programming, so please do not hate me for dirty code. I would love to get beginner friendly tips if you have some for me. And sorry for my english I hope you can understand me and maybe try my code yourself to see my problem in action.
I have a Windows form with a group box, in the group box is a panel. Directly in the Form there is a Button to add a row with a set of Controls (in my case 1 row has 2 buttons. One without sense now and one to delete the row) into the panel.
The buttons in one row should have the same tags (1-X)
So adding a row with my 2 button-set works "fine". My next plan was to delete the row when i press the delete button from a row.
After Deletion of a row which i identify with Control Tags, I want to decrease the Number Values for Name (Function 2 to Function 1 if I delete the row 1 for example), Tag and Text from each button which has a higher Tag Value than the row number which got deleted. So theres the failure somewhere I guess.
It's working fine to Add and Remove. But not if i want to add a row again. I must click multiple times then to add a new row.
To explain what I want to do:
But they mostly "never" rename like i've planned in my code/mind. Only sometimes when "playing" with it it will rename a button
My Code looks like this (start with a Winform with a panel named pnl and the Row AddButton):
If i alwas remove the last row, also multiple times, the rowCount works also when adding and loop this procedere. But if i delete some rows between and addin some new ones, the rowCounter is not true anymore.
Thanks for any help in advice.
Hope you can understand my problem.