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. Web Development
  3. ASP.NET
  4. Calling Event in VB.nET

Calling Event in VB.nET

Scheduled Pinned Locked Moved ASP.NET
csharphelp
6 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.
  • Y Offline
    Y Offline
    yogesh_kumar_agarwal
    wrote on last edited by
    #1

    C# Code

    this.Dispatcher.BeginInvoke(delegate()
    {
    PropertyChanged(this, new PropertyChangedEventArgs("FileLength"));
    });

    VB.NET Code

        Me.Dispatcher.BeginInvoke(Function() Do
            RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs("FileLength"))
        End Function)
    

    But it is not working i tried the code convert for the same, then did google also but unable to get the correct syntax. Plz help

    N D 2 Replies Last reply
    0
    • Y yogesh_kumar_agarwal

      C# Code

      this.Dispatcher.BeginInvoke(delegate()
      {
      PropertyChanged(this, new PropertyChangedEventArgs("FileLength"));
      });

      VB.NET Code

          Me.Dispatcher.BeginInvoke(Function() Do
              RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs("FileLength"))
          End Function)
      

      But it is not working i tried the code convert for the same, then did google also but unable to get the correct syntax. Plz help

      N Offline
      N Offline
      Not Active
      wrote on last edited by
      #2

      VB.NET doesn't support anonymous delegates so there is no direct conversion of this. http://social.msdn.microsoft.com/Forums/en-US/csharpgeneral/thread/08c82be8-bf9a-4a03-b366-b2d8c503e1d1[^]


      I know the language. I've read a book. - _Madmatt

      Y 1 Reply Last reply
      0
      • N Not Active

        VB.NET doesn't support anonymous delegates so there is no direct conversion of this. http://social.msdn.microsoft.com/Forums/en-US/csharpgeneral/thread/08c82be8-bf9a-4a03-b366-b2d8c503e1d1[^]


        I know the language. I've read a book. - _Madmatt

        Y Offline
        Y Offline
        yogesh_kumar_agarwal
        wrote on last edited by
        #3

        So what is the way to do the same. the senerio is i have a delegate defind say "ProgressChangedEvent" i my class i have a event "UploadProgressChanged" of type "ProgressChangedEvent" now RaiseEvent ProgressChangedEvent(me,args) working fine for me, but i want the asyncronous call, so want to use. dispature.beginInvoke( ) so how could i call the event. Thanks Plz help...

        1 Reply Last reply
        0
        • Y yogesh_kumar_agarwal

          C# Code

          this.Dispatcher.BeginInvoke(delegate()
          {
          PropertyChanged(this, new PropertyChangedEventArgs("FileLength"));
          });

          VB.NET Code

              Me.Dispatcher.BeginInvoke(Function() Do
                  RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs("FileLength"))
              End Function)
          

          But it is not working i tried the code convert for the same, then did google also but unable to get the correct syntax. Plz help

          D Offline
          D Offline
          Dave Doknjas
          wrote on last edited by
          #4

          Drop the "Do" - this is a bug in the converter you used. You can drop the 'End Function' since it's just a single statement. Which version of VB are you using? If you're using VB10 (VS 2010), change the 'Function' to 'Sub' since nothing is being returned.

          David Anton Convert between VB, C#, C++, & Java www.tangiblesoftwaresolutions.com

          Y 1 Reply Last reply
          0
          • D Dave Doknjas

            Drop the "Do" - this is a bug in the converter you used. You can drop the 'End Function' since it's just a single statement. Which version of VB are you using? If you're using VB10 (VS 2010), change the 'Function' to 'Sub' since nothing is being returned.

            David Anton Convert between VB, C#, C++, & Java www.tangiblesoftwaresolutions.com

            Y Offline
            Y Offline
            yogesh_kumar_agarwal
            wrote on last edited by
            #5

            Hi David, Thanks for the reply is am using VS2008 SP1. My Code is like below

            Me.Dispatcher.BeginInvoke(Function() Do
            RaiseEvent PropertyChanged(Me,New PropertyChangedEventArgs("UploadPercent"))
            End Function)

            As per your instructions i have change it to

            Me.Dispatcher.BeginInvoke(Sub
            RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs("UploadPercent"))
            )

            But it is again not working for me.... Possible solution??? Thanks

            D 1 Reply Last reply
            0
            • Y yogesh_kumar_agarwal

              Hi David, Thanks for the reply is am using VS2008 SP1. My Code is like below

              Me.Dispatcher.BeginInvoke(Function() Do
              RaiseEvent PropertyChanged(Me,New PropertyChangedEventArgs("UploadPercent"))
              End Function)

              As per your instructions i have change it to

              Me.Dispatcher.BeginInvoke(Sub
              RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs("UploadPercent"))
              )

              But it is again not working for me.... Possible solution??? Thanks

              D Offline
              D Offline
              Dave Doknjas
              wrote on last edited by
              #6

              For 2008, you'll need:

              Me.Dispatcher.BeginInvoke(Function() AnonymousMethod1())

              Private Function AnonymousMethod1() As Object
              PropertyChanged(Me, New PropertyChangedEventArgs("FileLength"))
              Return Nothing
              End Function

              David Anton Convert between VB, C#, C++, & Java www.tangiblesoftwaresolutions.com

              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