ActiveControl

  • Thread starter Thread starter UK
  • Start date Start date
U

UK

I have 3 command buttons on a form. I need to change the
caption of the active control. How do I access the
properties of the command button using ActiveControl? Or
is there a different method of doing this?

Thanks.
 
You need to type-cast the active control to the correct
type. Try the following:

With CType(Me.ActiveControl, Button)
.Text = "SomeText"
.BackColor = Color.Red
.ForeColor = Color.White
End With

Good luck
 
Back
Top