ListView control issue

  • Thread starter Thread starter Vinay
  • Start date Start date
V

Vinay

Hi,

Is there a limit on maximum number of columns in listview
control ? I am finding:

In a listview control (Report Format) I am displaying a
record with 400 fields. I am creating its column names
dynamically (Field-1, Field-2 ...). What I am finding
after Field-362, column names are just blank but in the
data row text is being displayed properly till 400th
field. This is the scenario in XP environment.

In Win-98 environment till records having 362 fields are
getting displayed, but if a record contains more than
this number, no data is being displayed.

The code is NOT throwing any error.

Regards

Vinay
 
* "Vinay said:
Is there a limit on maximum number of columns in listview
control ? I am finding:

In a listview control (Report Format) I am displaying a
record with 400 fields. I am creating its column names
dynamically (Field-1, Field-2 ...). What I am finding
after Field-362, column names are just blank but in the
data row text is being displayed properly till 400th
field. This is the scenario in XP environment.

In Win-98 environment till records having 362 fields are
getting displayed, but if a record contains more than
this number, no data is being displayed.

I didn't find any information about a limitation like this. Did you
have a look at the memory usage of the application?
 
Hi Herfried,

Thanks for your reply.

Can you please elaborate about the memory usage (what
should I check ...). From the outside I don't find any
sign that application is looking for more memory (I may
be wrong.)

Regards

Vinay
 
* "Vinay said:
Thanks for your reply.

Can you please elaborate about the memory usage (what
should I check ...). From the outside I don't find any
sign that application is looking for more memory (I may
be wrong.)

It was only an idea. Maybe the application has memory problems when
adding 400 columns. You can check the memory usage with the task
manager. But, as you mentioned, I would expect an exception if there
are any problems with memory.

How many rows are you adding to the listview? Does the problem even
occur when you use this code to add column headers?

\\\
Dim i As Integer
For i = 1 To 400
Me.ListView1.Columns.Add("Column " & i.ToString(), 10, HorizontalAlignment.Left)
Next i
Me.ListView1.View = View.Details
///
 
Herfried,

This issue is coming at the time of adding column headers
and adding of only 2 records in a listview control. As no
exception is being thrown, I am assuming things are
normal on memory side.

A difference is occuring when application is running in
Windows-XP and Win-98 environments.

a. In Win-XP I am able to see the record fields beyond
(362) but no column headers (for fields 363 onwards), but
in Win98 environment no data and column headers are
visible if record field size goes beyond 362.


Regards

Vinay
 
* "Vinay said:
A difference is occuring when application is running in
Windows-XP and Win-98 environments.

a. In Win-XP I am able to see the record fields beyond
(362) but no column headers (for fields 363 onwards), but
in Win98 environment no data and column headers are
visible if record field size goes beyond 362.

The sample code I posted previously created a listview with 400
columns. It is working fine on my Windows XP machine, all column
header captions are showing up as expected.
 
Hi Herfried,

Thanks for your reply.

I tried your sample code and it is creating 400 columns.

With this new input, I have started to track my code
backwards as I am creating my listview control and adding
column names dynamically. My problem of missing column
names is still there, but I need to spend more time on
this issue. I would be updating this post with my
investigation on Monday (10th Nov).

I thank you for your input.

Regards

Vinay
 
* "Vinay said:
I tried your sample code and it is creating 400 columns.

With this new input, I have started to track my code
backwards as I am creating my listview control and adding
column names dynamically. My problem of missing column
names is still there, but I need to spend more time on
this issue. I would be updating this post with my
investigation on Monday (10th Nov).

OK, I'll mark it as "important".

;-)
 
Hi Herfried,

I am able to debug this issue. The column width parameter
in the following statement is creating problem:

Me.ListView1.Columns.Add("Column " & i.ToString(), 90,
HorizontalAlignment.Left)

Your sample code had 10 as width whereas I was using 90.
If I replace 10 with 90 in your code, I find the column
names are blank after Column364 or so.

In my present issue I have reduced the column size to 50
as a workaround, but would welcome your feedback.

BTW 9th Nov being Sunday, I didn't want to spend too much
time on this issue :=)

Regards

Vinay
 
Hi Vinay,

Thank you for your feedback. I have reported the issue.
I think this is by design about win32 control.

Regards,
Peter Huang
Microsoft Online Partner Support
Get Secure! www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
* "Vinay said:
I am able to debug this issue. The column width parameter
in the following statement is creating problem:

Me.ListView1.Columns.Add("Column " & i.ToString(), 90,
HorizontalAlignment.Left)

Your sample code had 10 as width whereas I was using 90.
If I replace 10 with 90 in your code, I find the column
names are blank after Column364 or so.

In my present issue I have reduced the column size to 50
as a workaround, but would welcome your feedback.

BTW 9th Nov being Sunday, I didn't want to spend too much
time on this issue :=)

Maybe it has something to do with the position calculation: 90 * 400 =
36,000, that's more than you can store in an 'Int16'. 362 * 90 can be
stored in an 'Int16'.

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
<http://www.mvps.org/dotnet>

<http://www.plig.net/nnq/nquote.html>
 
Back
Top