code_junkie

Multiple choice on WinForms

Nov 10th, 2011
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. private sub populateList( items as List(of UserChoices))
  2. dim choices as UserChoices
  3. dim defaultChoice as UserChoices
  4.  
  5. for each choice in items
  6. cboList.items.add(choice)
  7. '-- you could do user specific check or base it on some other
  8. '---- setting to find the default choice here
  9. if choice.state = _user.State or choice.state = _settings.defaultState then
  10. defaultChoice = choice
  11. end if
  12. next
  13. '-- you chould select the first one
  14. if cboList.items.count > 0 then
  15. cboList.SelectedItem = cboList.item(0)
  16. end if
  17.  
  18. '-- continuation of hte default choice
  19. cboList.SelectedItem = defaultChoice
  20.  
  21. end sub
Add Comment
Please, Sign In to add comment