Addhandler error with Toolstrip/Menustrip 'Buttons'
Addhandler error with Toolstrip/Menustrip 'Buttons'
Addhandler error with Toolstrip/Menustrip 'Buttons'
Addhandler error with Toolstrip/Menustrip 'Buttons'
Addhandler error with Toolstrip/Menustrip 'Buttons'
Addhandler error with Toolstrip/Menustrip 'Buttons' Addhandler error with Toolstrip/Menustrip 'Buttons' Addhandler error with Toolstrip/Menustrip 'Buttons' Addhandler error with Toolstrip/Menustrip 'Buttons' Addhandler error with Toolstrip/Menustrip 'Buttons' Addhandler error with Toolstrip/Menustrip 'Buttons' Addhandler error with Toolstrip/Menustrip 'Buttons' Addhandler error with Toolstrip/Menustrip 'Buttons'
Addhandler error with Toolstrip/Menustrip 'Buttons' Addhandler error with Toolstrip/Menustrip 'Buttons'
Addhandler error with Toolstrip/Menustrip 'Buttons'
Go Back  Xtreme Visual Basic Talk > > > Addhandler error with Toolstrip/Menustrip 'Buttons'


Reply
 
Thread Tools Display Modes
  #1  
Old 10-26-2014, 10:10 PM
Amerigo's Avatar
Amerigo Amerigo is offline
Centurion
 
Join Date: Jan 2009
Location: USA
Posts: 175
Default


Edit by Moderator: Re: How to get the conrol name on Mouse move
I'm trying to do something very similar.
Code:
        For Each item In ToolStrip1.Items
            If item Is CType(item, ToolStripButton) Then
                Dim Btn As Control = CType(item, ToolStripButton)
                AddHandler Btn.MouseEnter, AddressOf SpeakOnMouseOver

            End If
        Next
No matter what I do, I get errors either immediately or during debug. Since all of my 'buttons' are in toolstrips or menustrips, I need to add handers to each strip separately. Please help!
__________________
Amerigo

Last edited by Cerian Knight; 10-27-2014 at 01:29 AM.
Reply With Quote
  #2  
Old 10-27-2014, 10:12 AM
PlausiblyDamp's Avatar
PlausiblyDampAddhandler error with Toolstrip/Menustrip 'Buttons' PlausiblyDamp is offline
Ultimate Contributor

Forum Leader
* Expert *
 
Join Date: Nov 2003
Location: Newport, Wales
Posts: 2,058
Default

What errors are you getting? Details are quite important if you want people to help.
__________________
Intellectuals solve problems; geniuses prevent them.
-- Albert Einstein

Posting Guidelines Forum Rules Use the code tags
Reply With Quote
  #3  
Old 10-27-2014, 10:53 AM
Amerigo's Avatar
Amerigo Amerigo is offline
Centurion
 
Join Date: Jan 2009
Location: USA
Posts: 175
Default

Ok, I was getting different errors with different things I was trying. I have now changed methods (as per this post.
Code:
form_load...
WireToolStripEvents(ToolStrip1.Items)
Code:
    Private Sub WireToolStripEvents(container As ToolStripItemCollection)
        For Each tsItem As ToolStripItem In container
            '   wire up mouse events for tool-strip control
            AddHandler tsItem.Click, AddressOf SpeakOnMouseOver
            AddHandler tsItem.MouseHover, AddressOf SpeakOnMouseOver
            If TypeOf tsItem Is ToolStripDropDownItem Then WireToolStripEvents(CType(tsItem, ToolStripDropDownItem).DropDownItems)
        Next tsItem
    End Sub
I'm not getting any errors, but as with previous attempts, only the top level ToolStripItems are working. I get nothing from dropdownitems.
__________________
Amerigo
Reply With Quote
  #4  
Old 10-27-2014, 03:23 PM
PlausiblyDamp's Avatar
PlausiblyDampAddhandler error with Toolstrip/Menustrip 'Buttons' PlausiblyDamp is offline
Ultimate Contributor

Forum Leader
* Expert *
 
Join Date: Nov 2003
Location: Newport, Wales
Posts: 2,058
Default

You would need to check if the current item is a dropdown and if so recurse into it's items and add a handler to each that way.
__________________
Intellectuals solve problems; geniuses prevent them.
-- Albert Einstein

Posting Guidelines Forum Rules Use the code tags
Reply With Quote
  #5  
Old 10-27-2014, 03:46 PM
Amerigo's Avatar
Amerigo Amerigo is offline
Centurion
 
Join Date: Jan 2009
Location: USA
Posts: 175
Default

I figured it out. This line does that: If TypeOf tsItem Is ToolStripDropDownItem Then WireToolStripEvents(CType(tsItem, ToolStripDropDownItem).DropDownItems)
My problem was calling it with ToolStrip1 which has no dropdowns. I just had to correct it to MenuStrip1 which is my file menu.
__________________
Amerigo
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Addhandler error with Toolstrip/Menustrip 'Buttons'
Addhandler error with Toolstrip/Menustrip 'Buttons'
Addhandler error with Toolstrip/Menustrip 'Buttons' Addhandler error with Toolstrip/Menustrip 'Buttons'
Addhandler error with Toolstrip/Menustrip 'Buttons'
Addhandler error with Toolstrip/Menustrip 'Buttons'
Addhandler error with Toolstrip/Menustrip 'Buttons' Addhandler error with Toolstrip/Menustrip 'Buttons' Addhandler error with Toolstrip/Menustrip 'Buttons' Addhandler error with Toolstrip/Menustrip 'Buttons' Addhandler error with Toolstrip/Menustrip 'Buttons' Addhandler error with Toolstrip/Menustrip 'Buttons' Addhandler error with Toolstrip/Menustrip 'Buttons'
Addhandler error with Toolstrip/Menustrip 'Buttons'
Addhandler error with Toolstrip/Menustrip 'Buttons'
 
Addhandler error with Toolstrip/Menustrip 'Buttons'
Addhandler error with Toolstrip/Menustrip 'Buttons'
 
-->