?
Solved

Dblookuplistbox setting a selection

Posted on 2001-08-30
6
Medium Priority
?
1,151 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
Technology Partners: 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 75 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

Independent Software Vendors: 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!

Question has a verified solution.

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

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…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Suggested Courses
Course of the Month12 days, 10 hours left to enroll

777 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