MaskEdBox Background color change (VB)

CookieMonster24

Freshman
Joined
May 4, 2003
Messages
45
MaskEdBox Background color change

I'm trying to change the background color of a maskedbox. So far i'm not having any luck. What i have right now is :

maskedboxName.BackColor = System.Drawing.Color.Red

Any suggestions on what i'm doing wrong?
 
Is your control an inhertited one?
If so then insert the following code into your control class and it should do what you desire:
Visual Basic:
Public Sub New()
  mybase.New
  InitComponents()
End Sub

Private Sub InitComponents()
  Me.BackColor=System.Drawing.Color.Red
End Sub
 
Strange, normaly your code should work.
Where did you place this line of code?
Did you ensure that this property is not set anywhere else later.
How did you implement the masking.
 
On initial start up it has a mask of ##/##/####. I even created a test maskedbox to see if maybe i was doing something wrong. I just dragged it onto my form and used the same mask as above. i created a button with the exact same code that's above and nothing happens. I tried changing the forecolor as well and still nothing. I change the color of textboxes and everything works fine there. In terms of the property, with my test maskedbox nothing has been changed except the mask. Hopefully that explains a little more of my problem
 
It's a bug in the .NET 1.0 framework. The Masked Edit box is an ActiveX control and so doesn't have the best support anyway. Setting the ForeGround and BackGround colours works under the .NET 1.1 framework.
 
Back
Top