Maximum number of columns for a ListView control
-
I have a Windows.Forms.ListView control. On this control I need to have 310 columns. While scrolling through the listview the first 245 display without problems. After that, the column headers stop scrolling, but the data continues to scroll. Is there a setting somewhere for the max number of column headers that are allowed? Any idea what might be causing this? Thank you. Kalvin
- Kalvin
-
I have a Windows.Forms.ListView control. On this control I need to have 310 columns. While scrolling through the listview the first 245 display without problems. After that, the column headers stop scrolling, but the data continues to scroll. Is there a setting somewhere for the max number of column headers that are allowed? Any idea what might be causing this? Thank you. Kalvin
- Kalvin
I've learned a little more about what is going on with this. It isn't a problem with the number of columns, but the total width of all the columns. If I give each column a width of 140 then I have a problem scrolling. If I give each column a width of only 100 with 310 columns then there is no problem.
listView1.View = View.Details;
listView1.MultiSelect = false;
listView1.FullRowSelect = true;
listView1.HideSelection = false;for (int i = 0; i < 310; i++)
{
listView1.Columns.Add((i-1).ToString(), 140);
}ListViewItem itm = listView1.Items.Add("newRow");
foreach (ColumnHeader columnHeader in listView1.Columns)
{
itm.SubItems.Add(columnHeader.Index.ToString());
}- Kalvin
-
I have a Windows.Forms.ListView control. On this control I need to have 310 columns. While scrolling through the listview the first 245 display without problems. After that, the column headers stop scrolling, but the data continues to scroll. Is there a setting somewhere for the max number of column headers that are allowed? Any idea what might be causing this? Thank you. Kalvin
- Kalvin
-
I've learned a little more about what is going on with this. It isn't a problem with the number of columns, but the total width of all the columns. If I give each column a width of 140 then I have a problem scrolling. If I give each column a width of only 100 with 310 columns then there is no problem.
listView1.View = View.Details;
listView1.MultiSelect = false;
listView1.FullRowSelect = true;
listView1.HideSelection = false;for (int i = 0; i < 310; i++)
{
listView1.Columns.Add((i-1).ToString(), 140);
}ListViewItem itm = listView1.Items.Add("newRow");
foreach (ColumnHeader columnHeader in listView1.Columns)
{
itm.SubItems.Add(columnHeader.Index.ToString());
}- Kalvin
32768 / 140 is ~234...looks like exceeding 32768 pixels IS a bad idea[^] :)
Mark Salsbery :java:
-
Mark Salsbery wrote:
Could that be an issue?
Nope. It could be a paradox: when warned like that, there no longer is anything not to expect. :-D
Luc Pattyn [My Articles] Nil Volentibus Arduum
-
I have a Windows.Forms.ListView control. On this control I need to have 310 columns. While scrolling through the listview the first 245 display without problems. After that, the column headers stop scrolling, but the data continues to scroll. Is there a setting somewhere for the max number of column headers that are allowed? Any idea what might be causing this? Thank you. Kalvin
- Kalvin
Your specific problem has been identified, however I would suggest you have a greater problem in the design of the UI part of your application. I cannot imagine any scenario where it would be useful to any user that so many columns are displayed. Better to provide a means for the user to select to dispay differing subsets of the data so they can view what is relevant easily than to swamp them with so much data that requires endless scrolling IMO.
Dave
Binging is like googling, it just feels dirtier. Please take your VB.NET out of our nice case sensitive forum. Astonish us. Be exceptional. (Pete O'Hanlon)
BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) -
Your specific problem has been identified, however I would suggest you have a greater problem in the design of the UI part of your application. I cannot imagine any scenario where it would be useful to any user that so many columns are displayed. Better to provide a means for the user to select to dispay differing subsets of the data so they can view what is relevant easily than to swamp them with so much data that requires endless scrolling IMO.
Dave
Binging is like googling, it just feels dirtier. Please take your VB.NET out of our nice case sensitive forum. Astonish us. Be exceptional. (Pete O'Hanlon)
BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) -
I have a Windows.Forms.ListView control. On this control I need to have 310 columns. While scrolling through the listview the first 245 display without problems. After that, the column headers stop scrolling, but the data continues to scroll. Is there a setting somewhere for the max number of column headers that are allowed? Any idea what might be causing this? Thank you. Kalvin
- Kalvin