Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Best approach for listbox on values
Message
From
12/07/2001 06:52:30
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
11/07/2001 22:05:34
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00529536
Message ID:
00529600
Views:
21
>I am wondering what is the best approach to take when we have a listbox of type 1 - Value where we enter our own values in RowSourceType property. It's not like a listbox of type 3 - SQL where we can bound the control source to field on BoundColumn 2. Basically, what is the best approach to bound the control source when entering the values manually at the form designer level?

Michel,
It's just the same with the exception recordpointer wouldn't move in a cursor where you could directly use myComboCursor.Anyfield to check selected item (single selection).
You just provide n values per row where n is columncount. ie:
*mycombo.init && All props left at their default
With this
  .Rowsourcetype = 1
  .Rowsource = ;
     'Description 1,pk123,Col31,'+;
     'Description 2,pk138,Col32,'+;
     'Description 3,pk178,Col33,'+;
     'Description 4,pk198,Col34'  && 3 per row
  .Columncount = 3
  .Boundcolumn = 2
  .Columnwidths = '100,50,50'
Endwith

* A commandbutton click to check selected
With thisform.myCombo
  Messagebox( ;
    'Value : '+ .Value + chr(13)+;
    'Col1  : '+.List(.ListIndex,1)+chr(13)+;
    'Col2  : '+.List(.ListIndex,2)+chr(13)+;
    'Col3  : '+.List(.ListIndex,3) )
Endwith
Value returns column 2 (Boundcolumn) content but you can access any column value using List(ListIndex,ColNum) - (honestly I prefer List(Listindex,Col) approach vs value).

Note: If you have a controlsource defined and it's numeric then better you set bound to .t. otherwise you get listindex.
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