Solved

Dblookuplistbox setting a selection

Posted on 2001-08-30
6
1,129 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Making delphi communicate with a c# service 16 137
drawing animated level bar based on numbers 3 120
RESTRequest Parameter 4 77
Delphi: making a BW image transparent 10 135
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

737 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