Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Get selected item
Message
From
09/01/2004 08:59:16
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
09/01/2004 08:40:06
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00865405
Message ID:
00865411
Views:
17
This message has been marked as the solution to the initial question of the thread.
>To get selected items in a ComboBox, I can loop through each element, and check whether .Selected(i) is true.
>
>Is there a shortcut to get the selected element without writing a loop, assuming that .MultiSelect = .F.?
>
>And how about setting the initial value?
>
>As an example, I have a ComboBox to select months, with values "January, February, March...". In this case, I want to a) preset it to the current month, b) Get the user selection as a number (Jan. = 1, Feb. = 2...).
>
>Right now, I have assigned a number (as text) to a second, invisible, column - but I thought there might be a simpler way to do this.
>
>TIA,
>
>Hilmar.

ListIndex.

To be more clear :

myList.ListIndex = 4 && Sets initial selection to 4th item
myList.ListIndex = month(Date())

* Get selected month number
lnMonth = myList.ListIndex && You would store just Cmonth()
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform