level42 level42 - 1 month ago 10
Vb.net Question

Handling a very large list of options for a user

I have an application that allows the users to select a location.

Currently I have 5 locations to pick from, but I'd like to expand this to use a master list containing about 100 options.

I also need to have the user's preference saved.

Currently, my working code works as follows:

Save Setting:

My.Settings.SettingSearchLocationCAL = CInt(settingsRADlocationCAL.Checked)
My.Settings.SettingSearchLocationMIS = CInt(settingsRADlocationMIS.Checked)
My.Settings.SettingSearchLocationMON = CInt(settingsRADlocationMON.Checked)
My.Settings.SettingSearchLocationLON = CInt(settingsRADlocationLON.Checked)
My.Settings.SettingSearchLocationOTT = CInt(settingsRADlocationOTT.Checked)
My.Settings.SettingSearchLocationTOR = CInt(settingsRADlocationTOR.Checked)


Determin which location was selected:

If settingsRADlocationTOR.Checked = True Then
LocationName = "ontario"
LocationID = "1700272"
ElseIf settingsRADlocationOTT.Checked = True Then
LocationName = "ottawa"
LocationID = "1700185"
ElseIf settingsRADlocationMIS.Checked = True Then
LocationName = "ontario"
LocationID = "1700276"
ElseIf settingsRADlocationLON.Checked = True Then
LocationName = "london"
LocationID = "1700214"
ElseIf settingsRADlocationMON.Checked = True Then
LocationName = "montreal"
LocationID = "80002"
ElseIf settingsRADlocationCAL.Checked = True Then
LocationName = "calgary"
LocationID = "1700199"
End If


Currently, I'm using Radio Buttons for this, but I'm trying to figure out how I should allow the user to select their location. I've been experimenting with a File Menu, for the expandable menus features (Tree Arcitecture), seems to work ok for now.

My questuions are as follows:

Is there a better container I should be using? (User will select a Country, Province/State, and city. Ideally I'd like this all in 1 control, hence the file menu)

Is there a way I can import a txt file with the menu structure into the File Menu (or other container) as opposed to filling in each entry manually?

And.

How can I handle determining which option is selected on a list of over 100 entries? Would I need to continue having a .setting for each entry? or is there also a better way I can handle this?

Appreciate any help that can be provided. I hope what I've explained makes sense.

Thanks!

Answer Source

For the record, I decided to go with a File Menu, ComboBox simply did not meet my needs. Yes, it was an extensive amount of time to code it, but I'm much happier with the results.

P.S Thanks for the down vote guys.