@ Ian
Using the form re-size event worked perfectly. I ran into a small hiccup with col1. As the form widened col1 did not expand to reveal the rest of it's value. I corrected this but setting it's width to -1 (width of widest value). This caused it to look goofy however when it's value was 0. To correct this I just added an If statement stating that when listview items count is equal to 0/nothing that the columns be set to a numeric value rather than -1 & -2.
Thank you again IanCode:Private Sub AddLVHeaders() Dim colHeaders() As ColumnHeader = {New ColumnHeader With {.Text = "File Name", .Width = -1, .TextAlign = HorizontalAlignment.Left}, New ColumnHeader With {.Text = "File Type", .Width = -2, .TextAlign = HorizontalAlignment.Right}} ListView1.Columns.Clear() ListView1.Columns.AddRange(colHeaders) If ListView1.Items.Count = 0 Then Dim colHeaders_alt() As ColumnHeader = {New ColumnHeader With {.Text = "File Name", .Width = 306, .TextAlign = HorizontalAlignment.Left}, New ColumnHeader With {.Text = "File Type", .Width = -2, .TextAlign = HorizontalAlignment.Right}} ListView1.Columns.Clear() ListView1.Columns.AddRange(colHeaders_alt) End If End Sub Private Sub Form1_Resize(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Resize AddLVHeaders() End Sub
Resolved




Reply With Quote
