views:

108

answers:

2

I need to display a ListView in WinForms which should not have any lines between columns. I tried GridLines=false and also tried setting HeaderStyle to ColumnHeaderStyle.None. But this is not working. I want to remove the 2 vertical lines coming in the middle.

screenshot

+1  A: 

just change the view into Details

and GridLines=false

like:

        this.listView1.View = System.Windows.Forms.View.Details;
        this.listView1.GridLines = false;
Pramodh
A: 

GridLine = False should work. (See Pramodh answer.) If not, you have something else wrong. If you setting this property in code, make sure the control's handle has been created. The method CreateControl and IsHandleCreated are helpful.

A common problem in C# that affects controls is accessing control properties in the form's constructor. Usually, the control handles are not created until they are "visible", which doesn't happen until the form is loaded. Therefore, if setting in form constructor, move to the Load event which is recommended by Microsoft.

Control..::.CreateControl Method

The CreateControl method forces a handle to be created for the control and its child controls. This method is used when you need a handle immediately for manipulation of the control or its children; simply calling a control's constructor does not create the Handle.

CreateControl does not create a control handle if the control's Visible property is false. You can either call the CreateHandle method or access the Handle property to create the control's handle regardless of the control's visibility, but in this case, no window handles are created for the control's children.

AMissico