TableLayoutPanel is Messing Up

fristomer

New member
Joined
Mar 15, 2025
Messages
3
Programming Experience
3-5
I know the code can be cleaned up a bit... but I digress.

I'm having a little trouble with a TableLayoutPanel. For reference, I have two rows in the Database Table that are identical. The target is to create 2 rows, detailing the entries, plus one blank one for a new entry. However, the program seems to be adding blank cells in between the text-containing cells. My guess is that adding a third row would create additional problems... If anyone can help, it would be greatly appreciated. If you need more information, let me know.
 

Attachments

  • Screenshot 2025-03-15 063543.png
    Screenshot 2025-03-15 063543.png
    10.2 KB · Views: 2
  • Screenshot 2025-03-15 063648.png
    Screenshot 2025-03-15 063648.png
    140.6 KB · Views: 2
I found the error. And boy... do I feel sheepish???
The input row number was unnecessary and I was calculating the last row twice. I.E. I was putting tblAccessories.RowCount - 1 where it should not have been. The fix is attached, in case anyone else encounters this problem.
 

Attachments

  • Screenshot 2025-03-15 065009.png
    Screenshot 2025-03-15 065009.png
    9.7 KB · Views: 0
  • Screenshot 2025-03-15 065028.png
    Screenshot 2025-03-15 065028.png
    135.1 KB · Views: 0
Glad you solved your problem. Out of curiosity, why not use the DataGridView?

In the future, please post your code as text in code tags. Screenshots of code aren't useful, specially for people following threads on small mobile devices. It also makes it hard for people who want to help, but they will have to type in your code from scratch instead of being able to copy and paste the code.
 
Glad you solved your problem. Out of curiosity, why not use the DataGridView?

In the future, please post your code as text in code tags. Screenshots of code are useful, specially for people following threads on small mobile devices. It also makes it hard for people who want to help, but they will have to type in your code from scratch instead of being able to copy and paste the code.

No real reason. I guess I just feel like I have more control over the style, but perhaps I'm just unfamiliar with the DataGridView...

I will keep the code thing in mind in the future. Thanks!
 
Back
Top Bottom