Click here to Skip to main content
15,890,282 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
What would be the VB code for this C# code?...
C#
BeginInvoke(
                    new Action(() =>
                        {
                            explorerList = list;
                            dgvObjectExplorer.RowCount = explorerList.Count;
                            dgvObjectExplorer.Invalidate();
                        })



And This...
VB
ThreadPool.QueueUserWorkItem(
                (o)=>ReBuildObjectExplorer(text)
            );
Posted

1 solution

You can use this excellent converter : http://www.developerfusion.com/tools/convert/csharp-to-vb/[^]

Update:

Well the above mentioned tool converted your second query to this:

VB
ThreadPool.QueueUserWorkItem(Function(o) ReBuildObjectExplorer(text))


For the first one, it requires more code to support conversion.
 
Share this answer
 
v2
Comments
rspercy65 7-May-11 13:29pm    
I've tried all converters and all give the same results. None of it works.
Tarun.K.S 7-May-11 13:43pm    
Check my updated answer.
rspercy65 7-May-11 14:03pm    
ERROR : ThreadPool.QueueUserWorkItem(Function(o) ReBuildObjectExplorer(text)) does not produce a value.

It says it has to be a delagate Sub.
ThreadPool.QueueUserWorkItem(AddressOf ReBuildObjectExplorer, text) This works.

The other code...
BeginInvoke(
new Action(() =>
{
explorerList = list;
dgvObjectExplorer.RowCount = explorerList.Count;
dgvObjectExplorer.Invalidate();
})
};
has to remain in the sub it was created in. I tried using a Delagate sub but still no results are being displayed in the DataGridView. Here is the code I used...

Private Sub RebuildObjectExplorer(byVal text As String)
...blah, blah, blah
...
list.Sort(lastClassIndex + 1, list.Count - (lastClassIndex + 1), New ExplorerItemComparer())
explorerList = list

BeginInvoke(New Action(AddressOf PopulateGrid))
Catch

End Try
End Sub

Private Sub PopulateGrid()
dgv.RowCount = explorerList.Count
dgv.Invalidate()
End Sub

It seams to work in C-Sharp very well, but, not in VBNET

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900