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
  1. Home
  2. General Programming
  3. C#
  4. How to Convert VB.NET to C# ?????

How to Convert VB.NET to C# ?????

Scheduled Pinned Locked Moved C#
csharptutorialquestion
5 Posts 2 Posters 1 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.
  • I Offline
    I Offline
    Inquire2you
    wrote on last edited by
    #1

    Anyone know how to convert this following VB.NET to C# ? Private WithEvents _PStatus AS StatusBar Private Sub DrawItem(ByVal sender As Object, ByVal sbdevent As System.Windows.Forms.StatusBarDrawItemEventArgs) Handles _PStatus.DrawItem Thank

    M 1 Reply Last reply
    0
    • I Inquire2you

      Anyone know how to convert this following VB.NET to C# ? Private WithEvents _PStatus AS StatusBar Private Sub DrawItem(ByVal sender As Object, ByVal sbdevent As System.Windows.Forms.StatusBarDrawItemEventArgs) Handles _PStatus.DrawItem Thank

      M Offline
      M Offline
      mav northwind
      wrote on last edited by
      #2

      I'd try this:

      private StatusBar _PStatus;

      private void DrawItem(object sender, StatusBarDrawItemEventArgs sbdevent)

      But you have to tell the StatusBar that DrawItem is the event handler for the DrawItem event by writing:

      _PStatus.DrawItem += new StatusBarDrawItemEventHandler(this.DrawItem);

      after you've created the StatusBar. Regards, mav

      I 1 Reply Last reply
      0
      • M mav northwind

        I'd try this:

        private StatusBar _PStatus;

        private void DrawItem(object sender, StatusBarDrawItemEventArgs sbdevent)

        But you have to tell the StatusBar that DrawItem is the event handler for the DrawItem event by writing:

        _PStatus.DrawItem += new StatusBarDrawItemEventHandler(this.DrawItem);

        after you've created the StatusBar. Regards, mav

        I Offline
        I Offline
        Inquire2you
        wrote on last edited by
        #3

        Thank your.. But it doesn't work. Let me description more detail. MyStatusBarPanel Class : private StatusBar _PStatus; public void DrawItem(object sender, System.Windows.Forms.StatusBarDrawItemEventArgs sbdevent) { } public StatusBarProgressPanelClass(StatusBar sb) { _PStatus = sb; _PStatus.DrawItem += new StatusBarDrawItemEventHandler(this.DrawItem); } MyMainForm : pnl = new MyStatusBarPanel(statusBar1);

        M 1 Reply Last reply
        0
        • I Inquire2you

          Thank your.. But it doesn't work. Let me description more detail. MyStatusBarPanel Class : private StatusBar _PStatus; public void DrawItem(object sender, System.Windows.Forms.StatusBarDrawItemEventArgs sbdevent) { } public StatusBarProgressPanelClass(StatusBar sb) { _PStatus = sb; _PStatus.DrawItem += new StatusBarDrawItemEventHandler(this.DrawItem); } MyMainForm : pnl = new MyStatusBarPanel(statusBar1);

          M Offline
          M Offline
          mav northwind
          wrote on last edited by
          #4

          Without explicitely trying for myself the only thing I see right now that _could_ cause problems would be a naming conflict between the event DrawItem and the event handler function DrawItem. Change public void DrawItem() to private void OnDrawItem() and += new StatusBarDrawItemEventHandler(this.DrawItem); to += new StatusBarDrawItemEventHandler(this.OnDrawItem); then it could work. If it doesn't then it would help to know what errors you get. mav

          I 1 Reply Last reply
          0
          • M mav northwind

            Without explicitely trying for myself the only thing I see right now that _could_ cause problems would be a naming conflict between the event DrawItem and the event handler function DrawItem. Change public void DrawItem() to private void OnDrawItem() and += new StatusBarDrawItemEventHandler(this.DrawItem); to += new StatusBarDrawItemEventHandler(this.OnDrawItem); then it could work. If it doesn't then it would help to know what errors you get. mav

            I Offline
            I Offline
            Inquire2you
            wrote on last edited by
            #5

            Hi Mav, Thank your help. Actually, I forget to set a property of my parent contol, so the DrawItem never work. I find out my problem. P.S: your first response is work fine. Thank again :-D

            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