>Dear Ed:
>
>I test what you said. I don't run. I don't know if I explain the the issue O.K.
>
>The only problem is if you type the same code into a textBox that are in a grid.
>The code don't run. I don't want to make a subclass, only edit the GotFocus() event of the TextBox.
>
In order to change the GotFocus event of the textbox, you need to either do instance alteration of the textbox, where you change the code in the individual textbox instance, or create a subclass so that all instance of that class have the same code.
You can't do instance alteration of the textbox class within a grid, because each row of the grid instantiates a distinct instance of the textbox. The solution is to create a new class derived from the textbox base class that contains the behavior you want in the GotFocus. Doing that and adding the subclass to the column automatically adds the behavior to each instance without having to go in and change the behavior by hand each time.
>Why the code run O.K. in a TextBox (MyForm.TextBox) and don't run in a TextBox that are inside of a Grid (MyForm.MyGrid.MyColumn1.TextBox)? It's the same code and different results.
>
A textbox on a form is a single instance of a textbox; you can make instance changes. A textbox added to a column represents many distinct instances of the textbox.
>I think that the gotfocus() event of the TextBox, isn't the last event when the TextBox are inside a Grid. What event occurs after?
>
It has nothing to do with the order that events are fired, it has to do with how a Grid control behaves. You need to modify the class and not the instance of the class.