Search code examples
c#winformsscheduletimetable

What should I use to display a "time table" in windows form?


I am working on an app to show sort of a time table. Let's say I have a 2D array of items and I would like to display them in a 2D grid with both line and column headings (dayOfWeek x time). I also need to be able to change background color of each cell depending on the contents (for example if the items name at position [x,y] is empty, I want to display cell at that position with red background.

What I can do is arrange a bunch of textboxes to form a table (because I have a fixed array size). However, this approach seems a bit too complicated and I could imagine there is some easier way to do this. ListView maybe?

So what I am asking is this: What is the best tool, or way in windows forms I should use for my problem? I am not looking for a finished solution, just a little tip / guidence. Thanks in advance!


Solution

  • You can use a ListView adding the columns with myListView.Columns.Add("whatever", width) and you can change the cell color with myListView.ForeColor = redColor. Being redColor a Color type.