Link to home
Create AccountLog in
Avatar of curiouswebster
curiouswebsterFlag 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
ASKER CERTIFIED SOLUTION
Avatar of madgino
madgino
Flag of Romania image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
SOLUTION
Avatar of Bob Learned
Bob Learned
Flag of United States of America image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Avatar of 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.
Thanks.