Making Listview Columns Read Only

  • Thread starter Thread starter CaptainCaveman
  • Start date Start date
C

CaptainCaveman

Hi,

Is it possible to make a listview column read only?
If so, how is it possible?

TIA

CC
 
Is it possible to make a listview column read only?
If so, how is it possible?

Define "read-only." List views are by default 100% read-only in that you
can't change their values (LabelEdit is false). Are you perhaps talking
about resizing?
 
Hi Jeff,

Although I agree that the data should not be editable in a ListView cell, I
am finding that if I treble click in the first column I am able to edit the
text. The cell text becomes surrounded by square brackets, e.g. [My Text],
and I am therefore able to edit the text.

I already handle the double click, but it seems the third click makes the
cell editable.

Any further help would be much appreciated.

CC
 
Although I agree that the data should not be editable in a ListView cell,
I am finding that if I treble click in the first column I am able to edit
the text. The cell text becomes surrounded by square brackets, e.g. [My
Text], and I am therefore able to edit the text.

I already handle the double click, but it seems the third click makes the
cell editable.

Any further help would be much appreciated.

You've got something else going on. Is this a plain vanilla list view?
Select it in Design view in Visual Studio and then look at the Properties
window. In the dropdown at the top you'll see the name of the control (in
bold) followed by the class name. (You may have to increase the width of the
Properties window to see the full name.) Is it
"System.Windows.Forms.ListView"?

I put a regular list view on a form, added three items to it, and it never
exhibited the behavior you described. I tried several different views, too
(Details, List, etc.).
 
CaptainCaveman said:
Hi,

Is it possible to make a listview column read only?
If so, how is it possible?

The first column is editable unless you set "LabelEdit" false in Properties.
The other columns are always read only. Just go to Properties and set
"LabelEdit" false and you will have what you want.

Gary
 
The first column is editable unless you set "LabelEdit" false in
Properties.
The other columns are always read only. Just go to Properties and set
"LabelEdit" false and you will have what you want.

In .NET 2.0 (at least), LabelEdit is false by default, so there should be no
need to set it to false unless you previously set it to true.
 
Back
Top