Visual Studio Error - 'ContainerColumnHeaderConverter' is unable to convert

222 Views Asked by At

I'm using a TreeListView to display some data in a Windows Forms application. When I built the app, I had no problems. I was recently asked to add a button to the UI that caused me to reduce the size of the TreeListView a little so the button would fit at the bottom of the window.

My problem is that if I adjust any of the TreeListView control's properties in any way (change the size, add/remove an anchor, etc.), I am no longer able to save the file or rebuild the project. Instead of normal build errors, I get a Visual Studio error saying:

'ContainerColumnHeaderConverter' is unable to convert 'WinControls.ListView.ContainerColumnHeader' to 'System.ComponentModel.Design.Serialization.InstanceDescriptor'.

ContainerColumnHeaderConverter error

If I completely remove the TreeListView's columns, I can save/build again but the second I create new columns, the error returns.

Since I'm using the Properties box in Visual Studio to make changes rather than doing it in the code, I have no idea how this could be happening.

What am I doing wrong?

Thanks!

1

There are 1 best solutions below

1
On

I ended up just removing the columns and adding them back in the code. This gets around my original problem but doesn't really solve it.

Here's the code:

Public Sub LoadData(ByVal item As System.Windows.Forms.CheckedListBox)
    'Add the columns to the TreeListView so we can add data
    Dim col1 As New ContainerColumnHeader
    col1.Text = "Item"
    col1.Width = 180
    Dim col2 As New ContainerColumnHeader
    col2.Text = "Value"
    col2.Width = 118

    tlvDataPull.Columns.Add(col1)
    tlvDataPull.Columns.Add(col2)
End Sub