Calling Event in VB.nET
-
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
-
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
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
-
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
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...
-
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
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
-
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
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
-
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
For 2008, you'll need:
Me.Dispatcher.BeginInvoke(Function() AnonymousMethod1())
Private Function AnonymousMethod1() As Object
PropertyChanged(Me, New PropertyChangedEventArgs("FileLength"))
Return Nothing
End FunctionDavid Anton Convert between VB, C#, C++, & Java www.tangiblesoftwaresolutions.com