Avatar of curiouswebster
curiouswebster
Flag for United States of America asked on

Guidance on drawing and interacting with DateTimePickers matrix

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??

Thanks.
TimeArray.bmp
C#.NET ProgrammingASP.NET

Avatar of undefined
Last Comment
curiouswebster

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
madgino

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
SOLUTION
Bob Learned

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
curiouswebster

ASKER
Sorry, this is WinForms. I forgot to mention that in the post.  

Yes, I am trying to get the DateTimePickers working in a DataGridView.  I will check out the link this morning.

Thanks.
curiouswebster

ASKER
Thanks.
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck