Solved

Dblookuplistbox setting a selection

Posted on 2001-08-30
6
1,104 Views
Last Modified: 2010-05-18
Hi,

is it possible to set the selected item in a dblookuplistbox ? when i check the selecteditem property it has the value of the 1st thing in the list but it isn't selected (blue box around it) is it possible to set this blue box myself so it is selected.

I think it was possible with a normal listbox but i can't seem to find how to do it with a dblookuplistbox

thanks
0
Comment
Question by:joyrider
6 Comments
 
LVL 4

Expert Comment

by:YodaMage
ID: 6442001
I believe since a DB list box is intended to be linked to a data source, then just like a dbgrid, your selected value is not going to be based on an index but rather were the pointer currently resides in your dataset.
0
 

Author Comment

by:joyrider
ID: 6442106
so u can't actually selected it ? like u can when u select it with ure mouse ? or can it ?
0
 

Expert Comment

by:Pedja
ID: 6442120
I haven;t tried this, but since dblistbox is linket to data source, as I remember, when you open the list, blue box is set to item which shows current value of the field.
So, all you have to do is to set value of the field to wanted value before listbox is openned. However that means you will loose prevois value of the field.

I think waht you want to do (setting default value for the listbox) is not "polite" way to do it. It is beter to set default value to the field on record creation, not to change it when user enters that specific field. Second ay will confuse user.

Pedja

0
Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

 
LVL 10

Accepted Solution

by:
Jacco earned 25 total points
ID: 6442570
Hi JoyRider,

If you do

tblTest.Edit;
tblTest.FieldByName('MYFLD1').AsString := 'TEST';

If the field MYFLD1 is coupled to a TDBLookupListbox the item will be automatically selected.

Or maybe,

tblTest.Edit;
tblTest.FieldByName('MYFLD1').AsString := dbllbTest.Items[3]

Didn't test this though

Regards Jacco

0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 6443515
just modify the keyfield
0
 

Author Comment

by:joyrider
ID: 6444406
still don't have a blue box around it but at least i know there's always a value so not really a problem thanks
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
delphi prevent click fast 2 220
How to call a form that is in a DLL  from an application? 13 74
select query - oracle 16 100
DBCtrlGrid, Delphi, Scroll 8 15
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question