How can I sort label names on buttons within a form.

Automatically sort the names and put into the correct place within the form.

A-Z order sort can be left to right. Want some sensibility to the form not all mixed up.

Can you explain what you are doing and what the question is a bit?
I don't really understand the question.

I am using visual studio 2005 and vb.net.

I have a form called inspections with quite a few buttons, each button is named according to an inspection document that the button opens.

I want to sort the buttons left to right (A-Z order)then filling up the rest of the page. I would like it to happen automatically after adding a new button and putting the (text) documents name on the button.

It just becomes difficult to keep moving the buttons around in order for it to be alphabetically sorted.

Hi,

If you need only to store inspection documents in a A-Z order and the possibility to open those documents again. Then I should propose a Listbox.

The ListBox control enables you to display a list of items to the user that the user can select by clicking. A ListBox control can provide single or multiple selections using the SelectionMode property. The ListBox also provides the MultiColumn property to enable the display of items in columns instead of a straight vertical list of items. With this, the control can display more visible items and the user no longer needs to scroll to an item.

For more information, look here.

It is generally a bad idea to hard code your files or addresses or things like that in a program. It is always a pain to update your addresses and of course add new.

I suggest you follow Luc001's suggestion with a ListBox (Or a DataGridView if you like them better) and a datasource like an excel file or an access db. This way when you want to add a new document you can just add the title and the address to your datasource and be done with it, without changing your code or having to compile it again.

This article has been dead for over six months. Start a new discussion instead.