G
Guest
Hi,
I am trying to follow some MSDN articles on multi-threading as I need to
tryu and do it, but I am working in VB.NET and the articleas are in c#.
The articles are here: http://msdn2.microsoft.com/en-us/library/ms951089.aspx
In c# I have this code that works
delegate void ShowProgressDelegate(string pi, int totalDigits, int
digitsSoFar, out bool cancel);
void ShowProgress(string pi, int totalDigits, int digitsSoFar, out bool
cancel)
{
.....
ShowProgressDelegate showProgress = new ShowProgressDelegate(ShowProgress);
object inoutCancel = false; // Avoid boxing and losing our return value
// Show progress synchronously (so we can check for cancel)
//Invoke(showProgress, new object[] { pi, totalDigits, digitsSoFar,
inoutCancel});
cancel = (bool)inoutCancel;
// Show progress asynchronously
BeginInvoke(showProgress, new object[] { pi, totalDigits, digitsSoFar,
inoutCancel});
.....
}
how do I do that in VB.NET please?
I tried this below but it shows a compile error:
Delegate Sub ShowProgressDelegate(ByVal dblPctDone As Integer, ByVal
iMax As Integer, ByRef bCancel As Boolean)
Private Sub cmdExecute_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles cmdExecute.Click
Dim ShowProgress As New ShowProgressDelegate(AddressOf ShowProgress())
thanks for any help
Philip
I am trying to follow some MSDN articles on multi-threading as I need to
tryu and do it, but I am working in VB.NET and the articleas are in c#.
The articles are here: http://msdn2.microsoft.com/en-us/library/ms951089.aspx
In c# I have this code that works
delegate void ShowProgressDelegate(string pi, int totalDigits, int
digitsSoFar, out bool cancel);
void ShowProgress(string pi, int totalDigits, int digitsSoFar, out bool
cancel)
{
.....
ShowProgressDelegate showProgress = new ShowProgressDelegate(ShowProgress);
object inoutCancel = false; // Avoid boxing and losing our return value
// Show progress synchronously (so we can check for cancel)
//Invoke(showProgress, new object[] { pi, totalDigits, digitsSoFar,
inoutCancel});
cancel = (bool)inoutCancel;
// Show progress asynchronously
BeginInvoke(showProgress, new object[] { pi, totalDigits, digitsSoFar,
inoutCancel});
.....
}
how do I do that in VB.NET please?
I tried this below but it shows a compile error:
Delegate Sub ShowProgressDelegate(ByVal dblPctDone As Integer, ByVal
iMax As Integer, ByRef bCancel As Boolean)
Private Sub cmdExecute_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles cmdExecute.Click
Dim ShowProgress As New ShowProgressDelegate(AddressOf ShowProgress())
thanks for any help
Philip