Page 1 of 1

How to refresh data in dblookuplistbox

PostPosted: September 6th, 2005, 5:05 pm
by ssfftt
I have a table called SERVICE in my database (interbase, firebird 1.5)

I have a dblookuplistbox on my screen, after add new service into the table or edit selected service, i have this line of code on the purpose of refreshing the dblookuplistbox:

IBQuery1.Refresh;

however, the list in dblookuplistbox is not refreshed at all. I also tried :
dblookuplistbox.refresh and
dblookuplistbox.update

all these didnt work

can any one help me plz?

PostPosted: September 6th, 2005, 5:27 pm
by Kambiz
Try to reset the dblookuplistbox.ListSource to nil, and then set it again to its original value.

Thanks for response

PostPosted: September 7th, 2005, 2:24 am
by ssfftt
Thanks for ur quick response, looks like not working, I tried to add some lines to refresh query and dblookuplistbox, didnt work either. plz have a look at my code:

DBLookupListBoxList.ListSource := nil;
DModule.IBQService.Close;
DModule.IBQService.Open;
DBLookupListBoxListService.ListSource := DModule.DSListService;
DBLookupListBoxListService.Refresh;

Solution to: How to refresh data in dblookuplistbox

PostPosted: September 7th, 2005, 2:59 am
by ssfftt
Done, fixed myself! Just remembered:

1. to refresh the list, the transaction has to be closed first because it locks up the selected record.
2. every time ibtransaction.active is set false, its corresponding ibquery.active is set false automatically.

my code is below, hope it helps whoever has the same problem:

IBTransactionList.Active := false;
IBTTransactionList.Active := true;
IBQuery1.Open;

Re: How to refresh data in dblookuplistbox

PostPosted: June 14th, 2011, 1:44 pm
by emad
first of all I'm very glad that an Iranian specialist is administrator of this good site(I mean Kambiz).
you can solve your problem with TDBLookUpListBox in this way.
1)go to the DBCtrls unit and find TDBLookUpListBox's class declaration.
2)in the private area of class declaration find procedure SelectCurrent and move it in the public area.
3)in order to recompile DBCtrls.pas ,define it's path in the library path.(if it's not).
4)post a user define message in AfterScroll event of corresponding dataset . (PostMessage(Handle,WM_USER + 1,0,0);)
5)declare a message method to implement response to the user defined message.
6)in the implementation of message method call dblookuplistbox.SelectCurrent.