Cannot disable button in form

  • Thread starter Thread starter Andreas
  • Start date Start date
A

Andreas

Why can't I just disable a button within a form, in the same way I do with
other controls like text boxes?

I use the command:
Command129.Enabled = False
or
Command129.Enabled = True

based on some conditions, and I apply them on Form_Current() and _Click
events.
It will either not do anything at all, or display error that it cannot
disable while it has the focus.
 
It isn't because it's a command button, it's because you can't disable a
control (any control) if it has the focus. Move the focus to some other
control first e.g.:

somecontrol.SetFocus
Command129.Enabled = False
 
Ok, I did but it was also the way I was manipulating the boolean value.
False was -1 not 0 so my condition was also wrong.
 
If you use the keywords "True" and "False" then you will not need to worry
about whether it's 1 or -1.
 
Back
Top