|
Rank: Newbie Groups: Member
Joined: 11/9/2009 Posts: 5
|
I know that Toolbar.Items(3).Disabled=True will disable the fourth button.
Now, if the fourth button has CommandName of "Delete" how do I disable it by Name rather than by Index?
Thanks in Advance!
Lee
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi,
I believe you will need to loop through all items to find out the index first.
Thanks!
|
|
Rank: Newbie Groups: Member
Joined: 11/9/2009 Posts: 5
|
I guess I can use the following unless you have better suggestion:
toolbar1.items(KeyIndex("Delete")).disabled=true
Function KeyIndex(ByVal KeyName As String) As Short Dim iCount As Short For iCount = 0 To ToolBar1.Items.Count - 1 If ToolBar1.Items(iCount).Text = KeyName Then Exit For Next Return iCount End Function
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Yes. That's the best way to do it. Thanks for sharing!
|
|