unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
ComboBox1: TComboBox;
procedure Button1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
public
end;
var
Form1: TForm1;
ArrOpc : Array [1..5] of String = ('Opcion1','Opcion2','Opcion3','Opcion4','Opcion5');
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
var
i : Integer;
begin
for i := 0 to 9 do
ComboBox1.Items.Add('Opcion' + IntToStr(i+1));
end;
procedure TForm1.Button1Click(Sender: TObject);
var
i : Integer;
B : Boolean;
begin
if ComboBox1.Text <> EmptyStr then
begin
for i := Low(ArrOpc) to High(ArrOpc) do
if ComboBox1.text = ArrOpc[i] then
begin
MessageDlg('Item Encontrado en el Arreglo en la Posicion = ' + IntTostr(i),mtInformation,[mbOK],0);
B := True;
end;
if not B then
MessageDlg('Item No Encontrado en el Arreglo',mtError,[mbOK],0)
end
else
MessageDlg('No se Ha seleccionado Ningún Item',mtError,[mbOK],0);
end;
end.