Results 1 to 3 of 3

Thread: Multiple Controls using the same event *resolved*

Threaded View

  1. #1

    Thread Starter
    Hyperactive Member Colonel Klink's Avatar
    Join Date
    Aug 2002
    Location
    Gold Coast, Australia
    Posts
    329

    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?
    Last edited by Colonel Klink; Sep 20th, 2003 at 09:47 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width