Hola jimy99 y bienvenido a los foros de Club Delphi
Como a todo recién ingresado te invito a que le des una leida a nuestra
Guía de estilo.
Te pongo un ejemplo con Edits
Código:
#define NRO_EDITS 3
void __fastcall TForm1::CrearEdits(int Cant)
{
for(int i=0;i < NRO_EDITS; i++) {
TEdit *TE = new TEdit(this);
TE->Left = 8;
TE->Height = 25;
TE->Width = 100;
TE->Top = i* 45 + TE->Height;
TE->Name = "Edit" + IntToStr(i+1);
TE->OnKeyPress = EditKeyPress; // asignarle un evento x
TE->Parent = this; // o InsertControl(TE);
}
}
void __fastcall TForm1::EditKeyPress(TObject *Sender, char &Key)
{
Beep();
}
void __fastcall TForm1::Button1Click(TObject *Sender)
{
CrearEdits(NRO_EDITS);
}
Un saludo.