dear freinds,
from right clicking on project I have add New Item as Component class and change
component to TextBox. Then from Toolbox i have add Textbox from this component
Now, when i put the textbox from component i need a keypress event as a parent
event for all the textboxes.

pls guide for the same
thank a lot to all.

I didn't understand very well your quqestion but I guess u shoud add an event to your customized component as a textbox nested in a componen u can not use directly its properties methods and events. I give this solution may be the problem will be solved
assume that I have created a new component in witch I added a textBox called textBox1

using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;

namespace myTextBox
    public partial class UserControl1 : UserControl
        public UserControl1()
        private string Text
            get { return textBox1.Text; }
            set { textBox1.Text = value; }
        /*I can fire the TextBox1 event from a method that I define as 
         * public to be visible when I use the component later in the main project*/
        private void FireTheKeyPressEvent()
            // This line fire the event from this method
            textBox1.KeyPress += new KeyPressEventHandler(textBox1_KeyPress);

        private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
           // TO DO: implement the event handler method


Edited 3 Years Ago by pyTony: fixed formatting

If u try the previous code The FireTheKeyPressEvent() will not appear in the method list when u instantiate a new compoment object now try to put public void FireTheKeyPressEvent() rather thant private void FireTheKeyPressEvent() u will see the method in the methods list of the object
I we summarize The KeyPress Event related to the textbox in the component will not appear within the component properties and method list except the u define it in the as a component class member and I insist that u define it as public

This question has already been answered. Start a new discussion instead.