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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Button Menu Index 1

Status
Not open for further replies.

dvannoy

MIS
May 4, 2001
2,765
0
0
US
I have a toolbar that i want to have 4 dropdown buttons with menus. I am having a problem when clicking onto the menu item..I can get the first button to work but when trying to use the second one it pulls up the same thing as the first one..

Select Case ButtonMenu.Index
Case "1"
frmForm.Show
End Select

I also tryed using the key but could not get that to work

Any help would be appreciated

Thanks

 
don't use the brackets ("") for your case but just the value of the index...

Select Case ButtonMenu.Index
Case 1
frmForm.Show
Case 2
Action...
End Select

and also check if all your indexes are different and all your buttons belong to the same group
 
Thats what I have been doing. But if there is more then one button menu on the toolbar they both will have a index of 1. there has to be a way to either use the key or something to identify the button.
 
Did you try to change Indexes in Toobar properties window?
 
Yes...it wont not let me..maybe i will try and delete the toolbar and recreate it again and see what happens.
 
Try this code. May be that'll help
Code:
For i = 1 To tbr.Buttons.Count
 For m = 1 To tbr.Buttons.Item(i).ButtonMenus.Count
      Select Case tbr.Buttons.Item(i).ButtonMenus(m).Index
             Case 1
                 frmMyForm.Show
             Case 2
                 'do something
      end select   
Next m
Next i
 
This is driving me crazy..

can anyone help me correct this.

I have deleted all the buttons and started over. I have two drop down menu buttons. in both buttons there is an index of 1. how do I make it so this system knows the difference of which button gets clicked??
 
You might want to look at the following property:

ButtonMenu.Parent.Index

and update your case statement to something like the following:

Select Case ButtonMenu.Parent.Index
Case 1
Select Case ButtonMenu.Index
Case 1
Case 2
End Select
Case 2
Select Case ButtonMenu.Index
Case 1
and so on

The Parent.Index can be used to distinguish between the two buttons on the toolbar. Good Luck
--------------
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein
 
Ahhhh!!!!!

Thank you!

I gues Email Notification is not working with this web site right now..

 
My suggestion is not to use Index as it can change if you add a button.

Instead make sure you set the KEY property and use it (which is a string)

Select Case ButtonMenu.Key
Case is = "Open"
.
.
.
Case is = "Save"
.
.
.
End Select

Its bad when you use an index property then add a item in the middle and have to shift the number you compairing the index to by 1 in a hundred different places.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top