Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
C

christoph33

@christoph33
About
Posts
6
Topics
1
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • get handlers from existing events in vb in an easy way
    C christoph33

    That would be a very good solution. I'll try it out. Thanks Chris

    Visual Basic question csharp

  • get handlers from existing events in vb in an easy way
    C christoph33

    Then I have to write 15 or more new delegates? Right? The aim was to add a toolstrip to the existing menustrip to act like a buddy. The new toolstrips get all properties from the existing menustrips and share the same events (there are more than 1 menustrip in the mdi). So I thought I could put some code-lines into a loop....

    Visual Basic question csharp

  • get handlers from existing events in vb in an easy way
    C christoph33

    I got a solution, but with that I have to declare all Menuitem_Click-Subs as Public and I have to set an InitFlag into them to supress invocation, because CallByName calls the event... For Each Mi As ToolStripItem In FileMenu.DropDownItems If TypeOf (Mi) Is ToolStripMenuItem Then Dim mmi As New ToolStripButton mmi.Text = "" mmi.Image = Mi.Image mmi.ToolTipText = Mi.Text Dim pArray() As Object = {Mi, New System.EventArgs} Dim delegateMn As System.EventHandler = CType(CallByName(Me, Mi.Name & "_Click", CallType.Method), System.EventHandler) AddHandler mmi.Click, delegateMn tsProgramm.Items.Add(mmi) ElseIf TypeOf (Mi) Is ToolStripSeparator Then Dim mmi As New ToolStripSeparator tsProgramm.Items.Add(mmi) Else End If Next

    Visual Basic question csharp

  • how to identify tab key press in vb.net
    C christoph33

    You can set the property AcceptTab of the control. Then you get the KeyDown, -Press, -Up - Events. But to get the focus-change, you must then use the mouse. HTH Chris

    Visual Basic csharp tutorial

  • get handlers from existing events in vb in an easy way
    C christoph33

    MidwestLimey wrote:

    Where is this existing click handler coming from?

    I wrote it, every menuitem has a eg fileopen_click(sender, e) handles fileopen.click.

    MidwestLimey wrote:

    If you have, then keep a reference to the delegate for later assignment.

    Isn't there a get-the-address-of-the-onclick-event--function in the .net-jungle?

    MidwestLimey wrote:

    If you're refering to one used by the control internally, it maybe accessible via reflection - but that would be very poor design.

    Ugly, yes... Fastest way would be coding out every menuitem, but that's not very genious. Thanks for your answer Chris

    Visual Basic question csharp

  • get handlers from existing events in vb in an easy way
    C christoph33

    for the existing MenuStrip-Item I want to create an appropriate ToolStrip with identical buttons. But how can I access the existing click-events? I cannot "addhandler mmi.click, adressof mi.click" and "adressof mi.onclick" also fails because it's protected. In c# I must add the handlers manually, so I know them, but in vb it's hidden... For Each Mi As ToolStripItem In FileMenu.DropDownItems If TypeOf (Mi) Is ToolStripMenuItem Then Dim mmi As New ToolStripButton mmi.Text = "" mmi.Image = Mi.Image mmi.ToolTipText = Mi.Text addhandler mmi.click, "get the handler of the mi.click-event" tsProgramm.Items.Add(mmi) ElseIf TypeOf (Mi) Is ToolStripSeparator Then Dim mmi As New ToolStripSeparator tsProgramm.Items.Add(mmi) Else End If Next Thanks in advance Chris

    Visual Basic question csharp
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups