Multiple Controls using the same event *resolved*
i have this code, when i dynamically create a textbox....
Code:
txt.KeyUp += new System.Windows.Forms.KeyEventHandler(txt_KeyUp);
i have this for a generic event handler (ie multiple texboxes use this event)
Code:
private void txt_KeyUp(object sender, System.Windows.Forms.KeyEventArgs e)
{
TextBox txtbox = (TextBox)sender;
try
{
if(e.KeyValue.ToString() == "13")
{
if (txtbox.Text != "")
{
connection.Sender.PublicMessage(txtbox.Tag.ToString(), txtbox.Text);
txtbox.Text = "";
}
}
}
catch( Exception e1 )
{
rtfStatusOut.Text = "\n" + e1;
}
}
however, when i use it, it doesnt send and clear the textbox, nor does it raise an exception
any ideas on what it could be?