Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Combobox loosing it's spot.
Message
From
11/07/2003 09:18:38
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00809009
Message ID:
00809175
Views:
21
>I have a view that's being used as the RowSouce for a combobox. My problem is that the pointer location in the combobox doesn't match the record location in the view when I run this code.
>
>
>SELECT &lcView1Alias
>LOCATE FOR &lcView1Alias..Key_id = &lcView2Alias..Key_Id
>This.cboBox1.Value = &lcView1Alias..Name
>This.cboBox1.Refresh()
>LOCATE FOR &lcView1Alias..Key_id = &lcView2Alias..Key_Id
>
>
>The glitch is with the 3rd line of the code because &lcView1Alias.Name is not unique. If there are four 'names' that are the same, it always ends up on the first one once the 3rd line of code here is run, which is why the Locate is run again at the end. The problem is that now when a user clicks the downarrow on the combobox, it looks like they're sitting on the first 'name' instead of the one they selected. Anyone have any suggestions on how to fix this? (other than changing what cbobox1.value is? don't want to have to do that due to the amount of other code that would have to be changed).
>-thanks!

If rowsource is a view why are you playing with value. Just locate the record with unique key. You could even use the recno() as listindex :

LOCATE FOR &lcView1Alias..Key_id = &lcView2Alias..Key_Id
This.cboBox1.Listindex = recno()

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
Reply
Map
View

Click here to load this message in the networking platform