Click here to Skip to main content
14,735,745 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:

I want to add three header row to DatagridView.

Row1 -> Columns Header -> 2013,2014,2015 Years (Merge Months Count = 12)
Row2 -> Columns Header -> 1,2,3,...,12 Months (Merge Days of Month = 28,30, or 31)
Row3 -> Columns Header -> 1,2,3,...,28,29,30,31 Days of Month (I calculate this with DayInMonth(Years,Months)

|------------------------------------------2015------------------------------------------| Row1 Header
|--------------------------------------------1--------------------------------------------| Row2 Header
|1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31| Row3 Header

|-----------------------------------------2015---------------------------------| Row1 Header Continue
|--------------------------------------------2----------------------------------| Row2 Header Continue
|1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28| Row3 Header Continue

I want to like these rows and headers.

I use VB.NET 2012


1 solution

The DatagridView has only 1 HeaderRow.
But what you can do to solve the issue :
- you only display one month at time in the DGV
- you set a Label over the DGV which shows the user the selected Month and Year. Or perhaps you do it with 2 Labels - one for the Year and one for the Month.
The remaining must be done by the logic behind.

Perhaps you put all parts you need in a UserControl, give it the database and the UserControl has the logic to do the necessary parts for the visualisation ...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900