954,557 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Sorting buttons

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.

SG01
Newbie Poster
7 posts since Jun 2009
Reputation Points: 10
Solved Threads: 0
 

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

adam_k
Practically a Posting Shark
803 posts since Jun 2011
Reputation Points: 256
Solved Threads: 149
 

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.

SG01
Newbie Poster
7 posts since Jun 2009
Reputation Points: 10
Solved Threads: 0
 

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.

Luc001
Posting Whiz
376 posts since Mar 2010
Reputation Points: 85
Solved Threads: 98
 

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.

adam_k
Practically a Posting Shark
803 posts since Jun 2011
Reputation Points: 256
Solved Threads: 149
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: