Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   .NET (https://www.clubdelphi.com/foros/forumdisplay.php?f=17)
-   -   Llamar a evento Keypress (https://www.clubdelphi.com/foros/showthread.php?t=27793)

edgusano 30-11-2005 21:10:02

Llamar a evento Keypress
 
Hola a todos.
Como puedo hacer para realizar el llamado al evento keypress de un text, enviando en este llamado la tecla enter.
Esto para simular que se ha presionado esta tecla y el codigo asociado al evento keypress del text se ejecute.
Estoy utilizando C# Builder

dec 30-11-2005 22:02:29

Hola,

Prueba con algo así:

Código:

private void textBox1_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
{
        if(e.KeyChar == (char)Keys.Enter)
        {
          MessageBox.Show("Pulsaste la tecla ENTER");
        }
}

private void button1_Click(object sender, System.EventArgs e)
{
        textBox1_KeyPress(this, new KeyPressEventArgs((char)Keys.Enter));
}



La franja horaria es GMT +2. Ahora son las 03:28:57.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi