Retrieving index of pressed toolbar button 
Author Message
 Retrieving index of pressed toolbar button

I am having problems retrieving the index of a pressed toolbar button. In
VB6 it was accessable via button.index. in vb.net this property doesn't
exist. I can retrieve the image index, text, tooltip text even, but not the
index. If anyone has worked this out I would appreciate the help.

Many Thanks
Tim Neale



Sat, 06 Sep 2003 18:53:02 GMT  
 Retrieving index of pressed toolbar button
Hi,
try this:

Protected Sub ToolBar1_ButtonClick(ByVal sender As Object, ByVal e As
System.WinForms.ToolBarButtonClickEventArgs)

        If e.button = Me.ToolBar1.Buttons.Item(0) Then

                messagebox.Show("kal?skds")

        End If

End Sub

Detlef



Quote:
> I am having problems retrieving the index of a pressed toolbar button. In
> VB6 it was accessable via button.index. in vb.net this property doesn't
> exist. I can retrieve the image index, text, tooltip text even, but not
the
> index. If anyone has worked this out I would appreciate the help.

> Many Thanks
> Tim Neale




Sat, 06 Sep 2003 19:25:58 GMT  
 Retrieving index of pressed toolbar button
Thanks Detlef


Sat, 06 Sep 2003 22:21:26 GMT  
 Retrieving index of pressed toolbar button
I'm just using the Text property in a Select Case statement to access the
individual button.
Michael Sprague
Quote:

> I am having problems retrieving the index of a pressed toolbar button. In
> VB6 it was accessable via button.index. in vb.net this property doesn't
> exist. I can retrieve the image index, text, tooltip text even, but not the
> index. If anyone has worked this out I would appreciate the help.

> Many Thanks
> Tim Neale




Tue, 09 Sep 2003 23:04:27 GMT  
 Retrieving index of pressed toolbar button
and if the button is only a picture and no text?



Quote:
> I'm just using the Text property in a Select Case statement to access the
> individual button.
> Michael Sprague


> > I am having problems retrieving the index of a pressed toolbar button.
In
> > VB6 it was accessable via button.index. in vb.net this property doesn't
> > exist. I can retrieve the image index, text, tooltip text even, but not
the
> > index. If anyone has worked this out I would appreciate the help.

> > Many Thanks
> > Tim Neale




Wed, 10 Sep 2003 22:58:35 GMT  
 Retrieving index of pressed toolbar button
An alternative is to assign a string to the toolbar button's ItemData
property.  For example in the InitializeComponent method use:

    'This is a tool bar button with name TB1
    Me.TB1.ItemData = "1"


Quote:
> I am having problems retrieving the index of a pressed toolbar button. In
> VB6 it was accessable via button.index. in vb.net this property doesn't
> exist. I can retrieve the image index, text, tooltip text even, but not
the
> index. If anyone has worked this out I would appreciate the help.

> Many Thanks
> Tim Neale




Sat, 13 Sep 2003 01:19:36 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. Find out if button is pressed on a Word toolbar

2. Simultaneously pressing a key and mouse-clicking a button on a toolbar

3. programmatically pressing toolbar buttons

4. VB6: Problems with pressed / unpressed Toolbar buttons

5. Pressing button menu on a toolbar

6. Listview add index and retrieve index?

7. BUG: Toolbar-Buttons wrong pictures - toolbar.zip (1/1)

8. BUG: Toolbar-Buttons wrong pictures - toolbar.zip (0/1)

9. Changing Toolbar Button Properties Outside of the Toolbar

10. BUG: Toolbar-Buttons 32*32 wrong pricture - toolbar.zip (0/1)

11. BUG: Toolbar-Buttons 32*32 wrong pricture - toolbar.zip (1/1)

12. Open a custom form with a module-button (not a toolbar button)

 

 
Powered by phpBB® Forum Software