What is the best way to detect & store a listbox user setup?

This is from the ControlResized event of a DataGrid. I remember this because without the random numbers only the last column would be resized:

colWidths contain the column widths, which are saved in the preferences.

dim BeforeWidth as Integer = ColWidths.total dim currentWidth as Integer = me.Width - getScrollbarWidth dim theWidth as Integer dim thePercent as Double = currentWidth/BeforeWidth for currentCol as Integer = 1 to me.Cols me.Column(currentCol).Width = me.Column(currentCol).Width * thePercent theWidth = theWidth + me.Column(currentCol).Width next 'can't simply adjust the last column, the percentage values are so small that only the last column would get broader 'the random number gives the rest to all columns well randomly dim theRandom as new Random dim RandCol as Integer = theRandom.InRange(1, me.Cols) me.Column(RandCol).Width = me.Column(RandCol).Width + (me.Width - theWidth - getScrollbarWidth)

Thanks Beatrix, I’ll have a look at this in the morning - just a little late for analysis here now.

Have a look at http://www.mothsoftware.com/downloads/col_resize.zip . Remember: this is for the DataGrid.

It’s easier and quicker.

For custom settings, I store as XML then save in db.