Link to home
Start Free TrialLog in
Avatar of villartech
villartechFlag for United States of America

asked on

Changing text box border color

How do I change the border color of a text box in VB6 ?
ASKER CERTIFIED SOLUTION
Avatar of cx323
cx323

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Extending the TextBox won't work.  The OnPaint and OnPaintBackground methods of the TextBox control are not called and therefore you cannot modify their painting behavior.

About the best you can do would be to create a usercontrol that contains a TextBox set just inside it's border and then change the backcolor of the usercontrol to the desired "border" color.  This would give the effect of there being a border around the TextBox.  The same could be achieved by just dropping a textbox into a colored frame and sizing things correctly.

I know its a kludge but in all the posts about changing a textbox's appearance that I've seen, I've never come across a way to truely change the drawing behavior of a textbox.

I suppose another option would be to create a UserControl that recreates the functionality of a TextBox without actually inheriting from one...