Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Hi there,

 

I am trying to create a textbox dynamically in my code. When I try to set the backcolor of the textbox to somecolor, it doesn't happen. I find that the backcolor of the form is overriding the control's backcolor. Same is the case with forecolor. Can anyone help me?.

 

Thank You.

Posted

Hi,

 

The following is the code I tried.

 

Dim test as TextBox

 

'The following code goes into Form Load event

test.BackColor = System.Drawing.Color.Aqua

test.Text = "Hello"

test.Left = 300

test.Top = 400

Me.Controls.Add(test)

 

This works fine if I have it in Form Load. The same code doesn't work inside a button click event.

Posted

Oh yes, it does. I have a function call which checks if each textbox has a non-numerical value and highlights the respective fields. Then I set back the color of all the fields to the default color.

 

It works fine if I paste my code after this function call.

 

Thanks a lot 'PlausiblyDamp'... :)

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...