Urgent: Change code from C# to vb.net plzz

Joined
May 18, 2008
Messages
1
Reaction score
0
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top