Cannot disable button in form

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.
 
B

Baz

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
 
A

Andreas

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.
 
B

Baz

If you use the keywords "True" and "False" then you will not need to worry
about whether it's 1 or -1.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top