Hi, I am trying to add data from a DBEdit component to a ComboBox, but i get an error that says :

'Incompatible types: 'TStrings' and 'TCaption'

Hi
When you create your record in the main program,the field of that record
that want to show in the combobox,you should declare as "widestring"
'cause the tcaption = type = widestring(16 bit unicode char set)
I created a form,placed on a dbedit1,and a combobox1.
Double click on the form to program the 'OnCreate' event.

procedure tform1.formcreate(sender: tobject);
var something:record
                    name:widestring;
              end;
begin
     something.name:='FlamingClaw';
     dbedit1.text:=something.name;
     combobox1.text:=dbedit1.text;
end;

And the result is that the name field of the something record
is appeare in the combobox
Let's see the whole program:

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, Mask, DBCtrls;

type
  TForm1 = class(TForm)
    DBEdit1: TDBEdit;
    ComboBox1: TComboBox;
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.FormCreate(Sender: TObject);
var something : record
                    name:widestring;
                end;
begin
  something.name:='FlamingClaw';
  dbedit1.Text:=something.name;
  combobox1.Text:=dbedit1.Text;
end;

end.

(*by FlamingClaw 2010.03.21.Hungary*)
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.