-1

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!

Community
  • 1
  • 1
level42
  • 946
  • 2
  • 13
  • 33
  • What about a listbox with a textbox from which thd user can filter? – Tarik Jun 22 '14 at 20:23
  • If they can only pick one location I would use a combobox – Ken Tucker Jun 22 '14 at 20:24
  • I've been looking into ComboBoxes, and I've found this: http://www.brad-smith.info/blog/projects/dropdown-controls Though I'm not quite sure I like the look and feel of it. Seems kinda congested. – level42 Jun 22 '14 at 20:31
  • you can store objects in the standard CBO so it displays whatever text you desire, like a Location including with the ID you need, so all you'd have to do is grab the `.SelectedItem.ID`. A CBO will certainly result in MUCH less code and screen space - when was the last time you saw more than 2 or 3 radio buttons on a form (let alone 100?). – Ňɏssa Pøngjǣrdenlarp Jun 22 '14 at 20:59
  • This is why I'm looking for an alternative. I'm not a major fan of the CBO, the list would be rather extensive. I like the File Menu for the way it branches out. Shame I can't do the same with a CBO :( – level42 Jun 22 '14 at 21:58
  • you do know that you control how many items show in the dropdown at a time, right? the list can contain 100 but one 10 at one time. if the list is loaded from a source it can be done in a loop making it pretty trivial to populate as well as get the data from. – Ňɏssa Pøngjǣrdenlarp Jun 22 '14 at 23:34
  • Yes, but with regards to the tree structrue, and the branching out of sub sections in the list. I'm still not convinced that a CBO would work. May be the easiest, but not necessarily the best overall options. --- On a side note, does any one have any suggestions for handling the final choice and or saving the selected location? – level42 Jun 23 '14 at 00:32
  • a CBO **would** work and it would be easy for the user since they do alpha seeks, you just "arent a fan of the CBO". What would you "branch" it on? We only see 5 options...Province?, Country? For saving, depending on how much there is - again we only see 5, Id serialize a class. – Ňɏssa Pøngjǣrdenlarp Jun 23 '14 at 00:50
  • Comboboxes also contain all the bits and bobs for filterable lists and autocomplete, so all your user need do is start typing the name of their location and they go straight there. Less hovers, less clicks, less time, easier for them to use. I can't see the problem here, frankly. – Adrian Jun 23 '14 at 01:42
  • Hmm, I suppose I'll take another look at CBO's tomorrow then. Any idea how I should structure them? 1 CBO for each Catagory? (i.e 1 for country, 1 for province, 1 for state) or some other way? I'm no expert in CBO's fyi. – level42 Jun 23 '14 at 02:59
  • AND!!! .... Question down voted ... Thanks guys! – level42 Jun 25 '14 at 13:25

1 Answers1

0

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.

miken32
  • 42,008
  • 16
  • 111
  • 154
level42
  • 946
  • 2
  • 13
  • 33