unit MegaDemoServer_Main; interface uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, uDAPoweredByDataAbstractButton, uROPoweredByRemObjectsButton; type TMegaDemoServer_MainForm = class(TForm) DAPoweredByDataAbstractButton1: TDAPoweredByDataAbstractButton; Label1: TLabel; cbConnectionName: TComboBox; procedure FormCreate(Sender: TObject); procedure cbConnectionNameChange(Sender: TObject); private fCurrentConnectionName: string; public { Public declarations } function GetSelectedConnectionName: string; end; var MegaDemoServer_MainForm: TMegaDemoServer_MainForm; implementation uses MegaDemoServer_Data; {$R *.dfm} procedure TMegaDemoServer_MainForm.FormCreate(Sender: TObject); var i: integer; begin with MegaDemoServer_DataModule.ConnectionManager.Connections do for i := 0 to Count - 1 do begin cbConnectionName.AddItem(Connections[i].Name + ' - ' + Connections[i].Description, nil); if Connections[i].Default then begin cbConnectionName.ItemIndex := i; cbConnectionNameChange(cbConnectionName); end; end; end; function TMegaDemoServer_MainForm.GetSelectedConnectionName: string; begin Result := fCurrentConnectionName; end; procedure TMegaDemoServer_MainForm.cbConnectionNameChange(Sender: TObject); begin fCurrentConnectionName := copy(cbConnectionName.Text, 1, pos(' ', cbConnectionName.Text)-1); end; end.