Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Strange ListBox problem
Message
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00112798
Message ID:
00112858
Views:
18
>I am using a listBox to display a list of items from a database. I would like to get the ID of user-selected item, so I populate the list by setting the List Source property to "users.userID,UserName". I set the width of the first column to 0 to make the userID field invisible. In the init method of the form, I initialize the list so that the first item is selected using the line (THISFORM.ListBoxUsers.Value=1). Now, when the user makes a selection, I try to read the selection by reading the variable (THISFORM.ListBoxUsers.Value). However, this is returning the index number of the selected item instead of the userID field. I tried to fix this problem by setting "Bound To" property of the list box to ".T.". This seems to work, with a strange side effect. When I run the form, the first item is not highlighted as expected. When I try to select a different item in the list, the highlight appears only when the mouse button is down, and disappears when I release the mouse button. .
>This happens everytime I try to select an item from the list. This problem seems to appear only when the "Bound To" property is set to ".T.". How can I fix this problem?
>
>Mon

Instead of reading the (THISFORM.ListBoxUsers.Value) read the (THISFORM.ListBoxUsers.List[THISFORM.ListBoxUsers.ListIndex,1]). What the List property on a listbox does is read the actual values in the list. The ListIndex property holds the index value of the selected item in the list. the second argument in the List property tells what column to get the information from and in the case described that is the first column.
Previous
Reply
Map
View

Click here to load this message in the networking platform