Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Disable Button on a Toolbar 1

Status
Not open for further replies.

dvannoy

MIS
May 4, 2001
2,765
0
0
US
This has got to be an easy one.

How do you disable a button on a toolbar?? I can "Remove" it but cannot Disable it.

I have a toolbar with Image List and Buttons. I want to be able to Disable or Enable the Buttons based on the users login..

Thanks
 
Toolbar1.Buttons("ButtonIndex").Enabled=False

Replace "ButtonIndex" with the index of the button.
 
Disabling based on the button's index will work. However, IMO disabling based on a descriptive key makes code a little more readable. Here's how.

Make sure each button has a descriptive key (in the toolbar's right-click properties -- button tab).

When you want to disable a button, you can do it like this (for a toolbar named tbrTools and a button with the key name "cut.":
Code:
tbrTools.Buttons("cut").Enabled = False
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top