max number of columns on a DataGridView
We need a datagridview with more than 2000 columns.
The problem that we have is that only around 700 columns are showing correctly, and the remaining are not showing.
We need to do this because each column represents a day for example开发者_高级运维: 2009/01/01/
- 2009/01/02
Does this control have a limit of columns that can show correctly?
Using VS 2010.
Yes, I think there's limitation in the count of columns in DataGridView, check this
I suggest implement it like the calender in Outlook.
Good luck.
The maximum number of columns you can add is 654. This is based on the demo application which I created to check the maximum number of columns.
Steps:
- Create a Windows Forms Application project in
C#
. - Add a
Window From
named "Test" in your project. - Drag and drop a
DataGridView
control on yourwindows form
. - On Load event of the
windows
form write the following code: Execute the the application (
F5
) and see the number of columns.try { for (int i = 0; i < 1000; i++) { dataGridView1.Columns.Add(i.ToString(), i.ToString()); } } catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); }
The maximum number of columns you can add is 654
精彩评论