Search code examples
c#duplicatesnames

C# A way to implement a GUI roster Datatable with duplicate Column names?


I am trying to create a rostering program and require several columns (28 in total), with each Day containing 4 columns (for instance |Monday| (On|Off|Duty|Hours) ).However I am running into some problems with duplicate column names I am also thinking weather it would be worth possibly splitting the tables into Days to alleviate this problem But feel this may affect future features (where I am comparing Cells day by days) Below is a picture of a completed table that I am attempting to replicate:

enter image description here

Do you think I am going about this the wrong way? or would it be possible to replicate this in a GUI ?

I am fairly new in the world of C# so apologies if this is something really simple!

Also apologies if this Question is slightly open to discussion.


Solution

  • The text you can see in column headers (HeaderText property) does not have to be the name of the column (Name property).

    Thus a simple way to do what you want is to have Names be DayOfWeek_On/Off/Duty/Hours for example: Monday_On but have HeaderTExt be just On/Off/Duty/Hours.