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. Conversion from C#

Conversion from C#

Scheduled Pinned Locked Moved Visual Basic
csharphelpquestion
1 Posts 1 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.
  • S Offline
    S Offline
    Sonhospa
    wrote on last edited by
    #1

    Dear all :-) I converted a sample from C# to VB and get an error message. It looks simple, but still I don't understand... Would it be possible that C# allows calling an event directly, while VB doesn't? Or did my conversion tool go wrong? Here's the short sample code:

    private void OnWaveControlContextMenuPopup(ContextMenu menu)
    {
      if (this.WControlContextMenuPopup == null)
        return;
      this.WControlContextMenuPopup(menu);
    }
    

    where WControlContextMenuPopup is defined as an event:

    public event WControlContextMenuPopupDelegate WaveControlContextMenuPopup;

    After conversion I get the error message "Public Event WControlContextMenuPopup in an event and cannot be called directly. Use 'RaiseEvent'...". The error is shown in lines 2 and 5 of the converted code:

    Private Sub OnWControlContextMenuPopup(menu As ContextMenu)
    	If Me.WControlContextMenuPopup Is Nothing Then             <-----
    		Return
    	End If
    	Me.WControlContextMenuPopup(menu)                          <-----
    End Sub
    

    What would I have to change in the VB code to get the required result without error? Thanks for some insight... Mick

    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