Unnecessary ScrollBars showing in ListView

c#, winforms

Solution

header.Width = listView.Width;

Nope, you forgot about the border. Fix:

header.Width = listView.ClientSize.Width;

Problem

C# WinForms: Can't figure out why it is showing scoll bars in this screen shot? I still want it to show Vertical scroll bars "as needed", but this horizontal scroll bar? Why is it showing? My items aren't that wide... here is also some initialization I am doing on FormLoad ..if any part of that is the culprit ``` listView.Scrollable = true; listView.FullRowSelect = true; listView.View = View.Details; listView.HeaderStyle = ColumnHeaderStyle.None; ColumnHeader header = new ColumnHeader(); header.Text = "MyHeader"; header.Name = "MyColumn1"; header.Width = listView.Width; listView.Columns.Add(header); ```

Original source