[RESOLVED] Another UI Oddity that is bothering me
I have a ListView setup in Detailed view. I have 3 columns. No matter what width I set the columns, they look great in designer view but when I run the application they are squished and you can't even read the labels.
I have tried this:
VB Code:
MyColumn1.AutoResize(ColumnHeaderAutoResizeStyle.HeaderSize);
But that does nothing, as does its other modes. Also, adding and removing items from the list does not change the column width.
Setting the column width manually also does not change it.
The only way to change it is manually but I'd rather not do to.
Re: Another UI Oddity that is bothering me
The ListView.AutoResizeColumns and ColumnHeader.AutoResize methods will only work once the ListView has items in it. Also, if you add additional items then the columns will not autoresize themselves. You must call the method again.
Re: Another UI Oddity that is bothering me
Actually, forget the bit about items being required. That may have been a misinterpretation of the help on my part. I just added a ListView with three columns and a Button to a form. I called AutoResizeColumns on the ListView from the button Click without adding any items and it worked fine.
Re: Another UI Oddity that is bothering me
Thanks. I just tried it and it works after data has been added to the ListView.
Is there anyway to make the columns a fixed width before data is entered or do I have to enter data?
Re: Another UI Oddity that is bothering me
I'm not sure why it won't work for you without data. The help implies that that is so but I just called AutoResizeColumns on the ListView in the form's Load event handler without any items and it worked fine. I guess that as a hack you could add a blank item, resize the columns and then remove the item.
Re: Another UI Oddity that is bothering me
Thanks. I got it to work.
I was, stupidly, putting the call to AutoResizeColumns in the Constructor of my control instead of the Load event.
Thanks a lot. Too bad I can't give you any ratings (I've tried everytime you answered a question and it says I have to spread it around (I rated you once before, lol))