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. What is the equivalent VB.net for this C code?

What is the equivalent VB.net for this C code?

Scheduled Pinned Locked Moved Visual Basic
questioncsharphelpannouncement
3 Posts 3 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.
  • T Offline
    T Offline
    TJO1
    wrote on last edited by
    #1

    Not sure if this is best forum but... I am trying to convert somebody elses old C component into a VB.NET version and in the process add some more functionality. Silly me... I don't know any C at all but having an educated guess. This following bit has me stumped. Can anybody help with the conversion. protected void onMenuItemClick(Object sender, EventArgs e) { MenuItem item = (MenuItem)sender; if (MRUItemClicked != null) { string fileName = (string)_itemMap[item]; MRUItemClicked(this, new MRUItemClickedEventArgs(fileName)); } } Cheers Tim

    C _ 2 Replies Last reply
    0
    • T TJO1

      Not sure if this is best forum but... I am trying to convert somebody elses old C component into a VB.NET version and in the process add some more functionality. Silly me... I don't know any C at all but having an educated guess. This following bit has me stumped. Can anybody help with the conversion. protected void onMenuItemClick(Object sender, EventArgs e) { MenuItem item = (MenuItem)sender; if (MRUItemClicked != null) { string fileName = (string)_itemMap[item]; MRUItemClicked(this, new MRUItemClickedEventArgs(fileName)); } } Cheers Tim

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      This is obviously not C code, do you mean C# ? This code is C#. This is an event handler for a menu item click. It converts the senser to a MenuItem, which is what it is. MRUItemClicked is obviously a member variable, null is called Nothing from memory in VB land. _itemMap is obviously a dictionary/hash table member variable. MRUItemClicked appears to be a delegate. Which of those things do you not understand ? Do you know what a delegate is ? I assume you have _itemMap set up from converting the rest of the code ?

      Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog

      1 Reply Last reply
      0
      • T TJO1

        Not sure if this is best forum but... I am trying to convert somebody elses old C component into a VB.NET version and in the process add some more functionality. Silly me... I don't know any C at all but having an educated guess. This following bit has me stumped. Can anybody help with the conversion. protected void onMenuItemClick(Object sender, EventArgs e) { MenuItem item = (MenuItem)sender; if (MRUItemClicked != null) { string fileName = (string)_itemMap[item]; MRUItemClicked(this, new MRUItemClickedEventArgs(fileName)); } } Cheers Tim

        _ Offline
        _ Offline
        _AK_
        wrote on last edited by
        #3

        Probably this: Protected Sub onMenuItemClick(ByVal sender As Object, ByVal e As EventArgs) Dim item As MenuItem = CType(sender,MenuItem) If (Not (MRUItemClicked) Is Nothing) Then Dim fileName As String = CType(_itemMap(item),String) MRUItemClicked(Me, New MRUItemClickedEventArgs(fileName)) End If End Sub

        Best Regards, Apurva Kaushal

        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