listview- write to specific column

E

Eran.Yasso

Hello all,

This is my first time using listview.

I was looking in google for a way to write to a specific column. I have
3 columns in my list view.
I want to be able to write to a specific one.

Also, it seems that even when i set listview to have 3 colums, there's
a fourth one with no header. How can I remove it and have only 3
columns with with headers?

TIA.
 
O

Oliver Sturm

Hello Eran,

You are really posting to the wrong newsgroup here - this is a group for
the C# language, there are others that would be more appropriate for your
question, like *.framework.windowsforms.*. I'm just saying, as you haven't
had any replies so far.
This is my first time using listview.

I was looking in google for a way to write to a specific column. I have
3 columns in my list view.
I want to be able to write to a specific one.

The values for all columns apart from the first one are read from the
SubItems property of each ListViewItem. So to see anything at all in a
given row, you'll have to add a ListViewItem to the Items property of the
list view, then add one or more instances of ListViewSubItem to the
SubItems property of the ListViewItem.
Also, it seems that even when i set listview to have 3 colums, there's
a fourth one with no header. How can I remove it and have only 3
columns with with headers?

I assume what you mean is actually the remaining horizontal space that is
not currently taken up by the existing columns. Some 3rd party grid
controls have the ability of automatically resizing the columns to take up
any free space there may be, but I don't think the standard ListView
control has that feature. I may be mistaken, because I don't use it that
often.
Of course you could implement the feature yourself, listening to the
relevant resize events and recalculating the width of the columns so that
there's no remaining space.


Oliver Sturm
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top