Ver Mensaje Individual
  #17  
Antiguo 12-04-2011
coej coej is offline
Miembro
NULL
 
Registrado: abr 2011
Ubicación: MANCHEGO-ESPAÑOL
Posts: 65
Reputación: 14
coej Va por buen camino
Poniendo este codigo en unit no me salen los items...
Código Delphi [-]
interface

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

type
  TForm1 = class(TForm)
    ComboBox1: TComboBox;


    procedure ComboBox1KeyPress(Sender: TObject; var Key: Char);
    procedure FormShow(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}



procedure TForm1.ComboBox1KeyPress(Sender: TObject; var Key: Char);
begin
if key = Chr(13) then
with Combobox1 do
if (Text <> '') and (Items.Indexof (Text) < 0) then
Items.Add (Text);
end;
procedure TForm1.FormShow(Sender: TObject);
begin
 Combobox1.items.add('ITEM 1');
 Combobox1.items.add('ITEM 2');
end;


end.

Poniendo esto en Project , si...
Código Delphi [-]
program Project1;

uses
  Forms,
  Unit1 in 'Unit1.pas' {Form1};

{$R *.res}

begin
  Application.Initialize;
  Application.CreateForm(TForm1, Form1);
   Form1.Combobox1.Items.Add('Item 1');
  Form1.Combobox1.Items.Add('Item 2');
    Form1.Combobox1.Items.Add('Item 3');
  Application.Run;
end.

Ni idea de porque???
Responder Con Cita