troubleshooting Question

Guidance on drawing and interacting with DateTimePickers matrix

Avatar of curiouswebster
curiouswebsterFlag for United States of America asked on
.NET ProgrammingC#ASP.NET
4 Comments2 Solutions333 ViewsLast Modified:
I was creating the attached dialog using a DataGridView, since this is clearly a matrix of controls. but I ran into numerous problems when embedding a DateTimePicker both to handle dates and times. SO I have abandoned that plan and now want an old fashioned set controls I can easily interact with, since they will be created on the form. But I need the rows added by the user to be an extensible list.

I need to grab Location.Y from the prior row, add n pixels and combine that with the same Location.X values from the previous row when determining the locations of each control.
That should be easy.  What will be new for me is creating those controls and coming up with a way to assign a unique ID for the controls.

How do I create events for these controls when I do not know their ID's at compile time?  Can I put the controls into a list so they can be refernced via their index in the list?  When using the DataGridView, each event had an e.RowIndex value and that worked fine.  But to repeat myself, I had so many event problems to still resolve. I think this would be quicker.

Please make suggestions or point me towards a demo program.

Notice on the attached image, when the user clicks Edit, in some cases I would need to remove the text field and replace that with a text edit field.  Any suggestions on that transformation would also be appreciated.

Question: Will a TableLayoutPanel be easier for me to manage drawing this matrix of controls without the hassles I have gotten from the DataGridView??


Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 2 Answers and 4 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros