|
-
May 18th, 2008, 10:01 AM
#1
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
-
May 18th, 2008, 10:18 AM
#2
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/
-
May 18th, 2008, 10:58 AM
#3
Re: Can anyone change the code from C# to vb.net?
 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??
-
May 18th, 2008, 07:26 PM
#4
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
-
May 19th, 2008, 10:37 AM
#5
Re: Can anyone change the code from C# to vb.net?
-
May 19th, 2008, 11:50 AM
#6
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.
_
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|