The text in the dblistbox can't be selected lazarus / 16-Databases ---------------------------------------------------------------------- rabbit · 2010-01-23 05:55 I have written an application to view and edit my postgres databse table using zeos component.It was compiled and run ok. here is my code: Code: [Select]unit Unit1; {$mode objfpc}{$H+} interface uses   Classes, SysUtils, db, FileUtil, LResources, Forms, Controls, Graphics,   Dialogs, DbCtrls, DBGrids, StdCtrls, ZDataset, ZConnection; type   { TForm1 }   TForm1 = class(TForm)     Datasource1: TDatasource;     dbGrid1: TDBGrid;     DBListBox1: TDBListBox;     DBNavigator1: TDBNavigator;     Label1: TLabel;     ZConnection1: TZConnection;     ZTable1: TZTable;     procedure FormCreate(Sender: TObject);   private     { private declarations }   public     { public declarations }   end; var   Form1: TForm1; implementation { TForm1 } procedure TForm1.FormCreate(Sender: TObject); begin   ZConnection1.User := 'Myaccount' ;   ZConnection1.Password := 'Password' ;   ZConnection1.HostName := 'localhost' ;   ZConnection1.Protocol := 'postgresql-8';   ZConnection1.Database := 'Mydb' ;   Datasource1.DataSet := Ztable1;   Ztable1.Connection := ZConnection1;   ZConnection1.Connect;   ZConnection1.GetTableNames('',DbListBox1.Items);   ZTable1.ReadOnly := False;   Dbgrid1.ReadOnly := False;   ZTable1.TableName := DbListBox1.GetSelectedText;   ZTable1.Active := True; end; initialization   {$I unit1.lrs} end. Now the problem is that the text in the dblistbox1 can't be selected,so this line: Code: [Select]ZTable1.TableName := DbListBox1.GetSelectedText; would not be executed. Please,Can anyone tell me what is the reason? My programming environment: Lazarus 0.9.28+winxp+ZEOSDBO-6.6.6.stable ---------------------------------------------------------------------- rabbit · 2011-03-26 08:34 Now I have updated Lazarus to version 0.9.30,but the problem still exists. ---------------------------------------------------------------------- paweld · 2011-03-26 09:14 Code: [Select]unit Unit1; {$mode objfpc}{$H+} interface uses   Classes, SysUtils, db, FileUtil, LResources, Forms, Controls, Graphics,   Dialogs, DbCtrls, DBGrids, StdCtrls, ZDataset, ZConnection; type   { TForm1 }   TForm1 = class(TForm)     Datasource1: TDatasource;     dbGrid1: TDBGrid;              Label1: TLabel;     ListBox1: TListBox;     ZConnection1: TZConnection;     ZTable1: TZTable;     procedure FormCreate(Sender: TObject);     procedure ListBox1Click(Sender: TObject);   private     { private declarations }   public     { public declarations }   end; var   Form1: TForm1; implementation { TForm1 } procedure TForm1.FormCreate(Sender: TObject); begin   ZConnection1.User := 'sa' ;   ZConnection1.Password := 'pass' ;   ZConnection1.HostName := '.' ;   ZConnection1.Protocol := 'mssql';   ZConnection1.Database := 'test' ;   Datasource1.DataSet := Ztable1;   Ztable1.Connection := ZConnection1;   ZConnection1.Connect;   ZConnection1.GetTableNames('', ListBox1.Items);   ZTable1.ReadOnly := False;   Dbgrid1.ReadOnly := False;   Dbgrid1.DataSource := Datasource1; end; procedure TForm1.ListBox1Click(Sender: TObject); begin   ZTable1.TableName := ListBox1.GetSelectedText;   ZTable1.Active := True; end; initialization   {$I unit1.lrs} end. Lazarus 0.9.30 32-bit, Windows 7 Pozdrawiam / Best regards paweld