How to refresh data in dblookuplistbox

Please discuss general Delphi programming topics here.

How to refresh data in dblookuplistbox

Postby ssfftt » September 6th, 2005, 5:05 pm

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?
ssfftt
Active Member
Active Member
 
Posts: 9
Joined: September 6th, 2005, 5:02 pm

Postby Kambiz » September 6th, 2005, 5:27 pm

Try to reset the dblookuplistbox.ListSource to nil, and then set it again to its original value.
Kambiz
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2429
Joined: March 7th, 2003, 7:10 pm

Thanks for response

Postby ssfftt » September 7th, 2005, 2:24 am

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;
ssfftt
Active Member
Active Member
 
Posts: 9
Joined: September 6th, 2005, 5:02 pm

Solution to: How to refresh data in dblookuplistbox

Postby ssfftt » September 7th, 2005, 2:59 am

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;
ssfftt
Active Member
Active Member
 
Posts: 9
Joined: September 6th, 2005, 5:02 pm

Re: How to refresh data in dblookuplistbox

Postby emad » June 14th, 2011, 1:44 pm

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.
emad
Member
Member
 
Posts: 4
Joined: June 14th, 2011, 1:01 pm
Location: Iran,Isfahan,Naein


Return to Delphi Programming

Who is online

Users browsing this forum: Bing [Bot] and 2 guests

cron