[2005] Dunamically Change Listview Column Width Bug
I have a table of data that I display in a listview. I have a dialog box that allows user to manually adjust width on the fly of the columns. It seemed to be working pretty good except that if I increase it too much it text gets hidden. I am assuming this most likely has to do with the width of the listview and I will mess with that but here's my code to adjust the columns if anyone can offer advice.
Code:
Private Sub TrackBar1_Scroll(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TrackBar1.Scroll
' My.Settings.myHorSpace = TrackBar1.Value
frm1.ChangeMyAppScopedSetting("myHorSpace", TrackBar1.Value)
For Each frm2.columnheader In frm2.ListView1.Columns
frm2.columnheader.Width = TrackBar1.Value
frm2.columnheader.TextAlign = HorizontalAlignment.Center
Next
My.Settings.Reload()
frm2.Refresh()
' Display the trackbar value in the text box.
TextBox1.Text = TrackBar1.Value
End Sub