hi experts
i want to some change in textbox class ,
lick in got focus of textbox change color of text box and leave of text box change old color, i want to set Permanente code in text box property,
after changing we give a new name to text box class and use this class as well we need.
is it possible ?

I think you can accomplish this with relative ease.

First, create a new component, naming it whatever you want to call your new textbox control.

Second, in the designer (must have "Show All Files" selected for the project/solution) replace "Inherits System.ComponentModel.Component" with "Inherits System.Windows.Forms.TextBox".

Third, back in the non-designer file, add two properties for your focused color and your no focus color. Use System.ComponentModel.Description to enter the description for the field, System.ComponentModel.Category to place the item in a certain category and System.ComponentModel.DefaultValue to set the default value for the property. There are plenty of other design time options that you can decide on.

Lastly, create the GotFocus and LostFocus event handlers for the actually control (or override the OnGotFocus and OnLostFocus methods) and enter the value you'd like to change to be updated with the value set by the property.

Now that the control is created you can reference the project/dll and drag and drop this control on to your form at design time.

Hope this helps!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.