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
  1. Home
  2. General Programming
  3. Visual Basic
  4. Structuere with WithEvents members

Structuere with WithEvents members

Scheduled Pinned Locked Moved Visual Basic
question
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Marc Soleda
    wrote on last edited by
    #1

    Hi all, In VB2005 I want to create an structure that some of its members should be declared with the WithEvents statement as they generate events that I'd like to handle. The compiler doesn't permit to declare members of an strcuture with WithEvents. Is there any way to do it? thanks in advance, Marc Soleda

    ... she said you are the perfect stranger she said baby let's keep it like this... Dire Straits

    T 1 Reply Last reply
    0
    • M Marc Soleda

      Hi all, In VB2005 I want to create an structure that some of its members should be declared with the WithEvents statement as they generate events that I'd like to handle. The compiler doesn't permit to declare members of an strcuture with WithEvents. Is there any way to do it? thanks in advance, Marc Soleda

      ... she said you are the perfect stranger she said baby let's keep it like this... Dire Straits

      T Offline
      T Offline
      TwoFaced
      wrote on last edited by
      #2

      You'll have to use a class instead. Here is a link defining the differences. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcn7/html/vaconStructuresAndClasses.asp[^] Although a structure's methods can handle events the method must be shared and the handler must be added using Addhandler. To quote the info in the link: "A structure procedure can handle events only if it is a Shared (Visual Basic) Sub procedure, and only by means of the AddHandler Statement; any class procedure can handle events, using either the Handles keyword or the AddHandler statement. For more information, see Events and Event Handlers."

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

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