Can anyone change the code from C# to vb.net?
Can anyone change code from C# to vb.net. The code is as below:
public void UpdateTextBox(string data)
{
if ( txtOutput.InvokeRequired )
txtOutput.Invoke(new OutputUpdateDelegate(OutputUpdateCallback),
new object[] { data });
else
OutputUpdateCallback(data); //call directly
}
private void OutputUpdateCallback(string data)
{
txtOutput.Text += data;
}
I have tried and that has error on row
txtOutput.Invoke(new OutputUpdateDelegate(OutputUpdateCallback),
My code is
Public Sub UpdateTextBox(ByVal data As String)
If (TextBox2.InvokeRequired) Then
TextBox2.Invoke(New OutputUpdateDelegate(OutputUpdateCallback), New Object() {data})
Else
OutputUpdateCallback(data) ' //call directly
End If
End Sub
Private Sub OutputUpdateCallback( data As String)
TextBox2.Text += Data
End Sub
thanks in advance
Re: Can anyone change the code from C# to vb.net?
Code:
Dim del As MyDelSub
Dim del2 As MyDelSub
Dim delAll As [Delegate]
del = New MyDelSub(AddressOf WriteToDebug)
del2 = New MyDelSub(AddressOf WriteToDebug2)
delAll = MulticastDelegate.Combine(del, del2)
delAll.DynamicInvoke( Nothing )
http://www.developerfusion.co.uk/show/5251/2/
Re: Can anyone change the code from C# to vb.net?
Quote:
Originally Posted by dglienna
Code:
Dim del As MyDelSub
Dim del2 As MyDelSub
Dim delAll As [Delegate]
del = New MyDelSub(AddressOf WriteToDebug)
del2 = New MyDelSub(AddressOf WriteToDebug2)
delAll = MulticastDelegate.Combine(del, del2)
delAll.DynamicInvoke( Nothing )
http://www.developerfusion.co.uk/show/5251/2/
it do not relate to above. Isn't it??
Re: Can anyone change the code from C# to vb.net?
(via Instant VB):
Public Sub UpdateTextBox(ByVal data As String)
If txtOutput.InvokeRequired Then
txtOutput.Invoke(New OutputUpdateDelegate(AddressOf OutputUpdateCallback), New Object() { data })
Else
OutputUpdateCallback(data) 'call directly
End If
End Sub
Private Sub OutputUpdateCallback(ByVal data As String)
txtOutput.Text += data
End Sub
Re: Can anyone change the code from C# to vb.net?
Re: Can anyone change the code from C# to vb.net?
For small pieces of code, here is an online automatic translator.
http://www.carlosag.net/Tools/CodeTr...r/default.aspx
Use with care.
_