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 ?

Edited by tanvirahmad: n/a

7 Years
Discussion Span
Last Post by Stevoni

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!

Edited by Stevoni: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.