Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to handle numerics in a combobox?
Message
From
08/11/2002 05:10:30
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
08/11/2002 00:27:40
Henry Ravichander
RC Management Systems Inc.
Saskatchewan, Canada
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00720148
Message ID:
00720181
Views:
12
>Hi all:
>
>I have a combobox, type 2 whihc is populated using a select statement. The field being picked up is numeric.
>
>Do I have to convert that into character string and again covnvert it to a numeric value after the user has made a selection? How do I accomplish this?
>
>Thank you for your advise.

Henry,
If you're using a select statement then IMHO it's better to use RowSourcetype = 3.
You don't have to convert the string into numeric (but you have to if you use .Value or .List(row,col) of combo). When combo has a rowsourcetype which is a cursor/table (Alias,SQL,Query,Fields) as items selected, pointer moves in cursor to related record. Thus you could directly query alias.field even if the field is not one of the columns in combo. ie:
*Combo init
with this
 .RowSourcetype=3 && SQL
 .RowSource = 'select company,contact,cust_id, maxordamt'+;
              ' from customer into cursor crsCustomer'
 .ColumnCount = 2 && Show only company and contact
 .Columnwidts = '100,100'
endwith

*Some method
with thisform.myCombo
 lcCompany = .List(.ListIndex,1)
endwith
* Or shortcut
lcCompany = crsCustomer.Company
*This is not in columns
lnMaxOrdAmt = crsCustomer.MaxOrdAmt
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