Control name is a variable

  • Thread starter Thread starter DavPet
  • Start date Start date
D

DavPet

I have a control name from my form in a variable called MyControl.
How can I use the variable in code to set properties like:
when MyControl is equal to "Form_frmSSPI_LOGON.txtUserID"
I want to say

MyControl.backcolor = vbRed

but it doesn't work.
 
DavPet said:
I have a control name from my form in a variable called MyControl.
How can I use the variable in code to set properties like:
when MyControl is equal to "Form_frmSSPI_LOGON.txtUserID"
I want to say

MyControl.backcolor = vbRed

but it doesn't work.

MyControl = "txtUserID"
Me(MyControl).BackColor = vbRed
 
Back
Top