Results 1 to 4 of 4

Thread: Events, another C# conversion question...

  1. #1

    Thread Starter
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091

    Resolved Events, another C# conversion question...

    I've come across this in some code that I am converting to VB...

    Code:
    private static readonly object DockStateChangedEvent = new object();
    public event EventHandler DockStateChanged
    {
    	add	{	Events.AddHandler(DockStateChangedEvent, value);	}
    	remove	{	Events.RemoveHandler(DockStateChangedEvent, value);	}
    }
    Anyone want to give me a clue as to what it should look like after its converted? Its like a maze, you start from the cheese and work your way back to the mouse.

    Last edited by crptcblade; Oct 15th, 2004 at 02:48 PM.
    Laugh, and the world laughs with you. Cry, and you just water down your vodka.


    Take credit, not responsibility

  2. #2
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170
    Are those event properties? Event properties don't exist in VB.NET.

    Read this:

    http://msdn.microsoft.com/library/de...ipleevents.asp

    And this:

    http://msdn.microsoft.com/library/de...ustomevent.asp

  3. #3
    Frenzied Member ntg's Avatar
    Join Date
    Sep 2004
    Posts
    1,449
    Hi,

    Those seem like event properties, one of the features that I wish VB.Net had. The only way around it is to use the AddHandler/RemoveHandler methods but you can't do it as cleanly as in C#.

    Cheers,
    NTG
    "Feel the force...read the source..."
    Utilities: POPFileDebugViewProcess ExplorerWiresharkKeePassUltraVNCPic2Ascii
    .Net tools & open source: DotNetNukelog4NetCLRProfiler
    My open source projects: Thales SimulatorEFT CalculatorSystem Info ReporterVSS2SVNIBAN Functions
    Customer quote: "If the server has a RAID array, why should we bother with backups?"
    Programmer quote: "I never comment my code. Something that is hard to write should be impossible to comprehend."
    Ignorant quote: "I have no respect for universities, as they teach not practicle stuff, and charge money for"

  4. #4
    type Woss is new Grumpy; wossname's Avatar
    Join Date
    Aug 2002
    Location
    #!/bin/bash
    Posts
    5,682
    It'd be pretty easy to wrap this in a generic class though. True it would be an extra step but it could be done pretty easily.

    Mendhak, fancy having a go at this for The Project?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width