Convert C# to VB online tools not correct

Hi All,

I am trying to convert the C# code below to VB, but the online tools is not converting correctly. Can anyone please help me to get this converted.

Thanks
this.chkManageDragging.Checked += delegate { this.dragMgr.ListView = this.listView; };
this.chkManageDragging.Unchecked += delegate { this.dragMgr.ListView = null; };
this.chkDragAdorner.Checked += delegate { this.dragMgr.ShowDragAdorner = true; };
this.chkDragAdorner.Unchecked += delegate { this.dragMgr.ShowDragAdorner = false; };
this.sldDragOpacity.ValueChanged += delegate { this.dragMgr.DragAdornerOpacity = this.sldDragOpacity.Value; };
this.chkApplyContStyle.Checked += delegate { this.listView.ItemContainerStyle = this.FindResource( "ItemContStyle" ) as Style; };
this.chkApplyContStyle.Unchecked += delegate { this.listView.ItemContainerStyle = null; };
this.chkSwapDroppedItem.Checked += delegate { this.dragMgr.ProcessDrop += dragMgr_ProcessDrop; };
this.chkSwapDroppedItem.Unchecked += delegate { this.dragMgr.ProcessDrop -= dragMgr_ProcessDrop; };
this.chkShowOtherListView.Checked += delegate { this.listView2.Visibility = Visibility.Visible; };
this.chkShowOtherListView.Unchecked += delegate { this.listView2.Visibility = Visibility.Collapsed; };

Open in new window

ALawrence007Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

BTosonCommented:
Not sure of your original code etc but depending on what you want to do, this may be a starter:
Me.chkManageDragging.Checked = Me.dragMgr.ListView Is Me.listView
Me.chkManageDragging.Unchecked = Me.dragMgr.ListView is Nothing
Me.chkDragAdorner.Checked = Me.dragMgr.ShowDragAdorner
Me.chkDragAdorner.Unchecked = Not Me.dragMgr.ShowDragAdorner
Me.sldDragOpacity.ValueChanged = Me.dragMgr.DragAdornerOpacity = Me.sldDragOpacity.Value
Me.chkApplyContStyle.Checked = Me.listView.ItemContainerStyle Is CType(Me.FindResource("ItemContStyle"),Style)

Open in new window

0
Mike TomlinsonHigh School Computer Science, Computer Applications, and Mathematics TeachersCommented:
I think those are anonymous delegates?
http://msdn.microsoft.com/en-us/library/0yw3tz5k(VS.80).aspx

This part:

    delegate { this.dragMgr.ListView = this.listView; };

Think of it as an un-named method that only exists in memory and can only be accessed by the thing it is assigned to.

At any rate, VB.Net does NOT support anonymous delegates.  The conversion would require you to write SEPARATE actual methods for each piece and use addresof.
0
ALawrence007Author Commented:
Btoson,

Thanks for the reply. I get the following Error when I use your code:

'Public Event Checked(sender As Object, e As System.Windows.RoutedEventArgs)' is an event, and cannot be called directly. Use a 'RaiseEvent' statement to raise an event.    

Ide_Mind,

Can you maybe give me a sample to work with if I need to go that way?

Thanks to both.
0
Learn SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

BTosonCommented:
Ah sorry I was not clear that you were using events, wasn't with it!
As Idle_Mind said, you will have to create sepeate Subs for each event/event group.
Unforuntately VB.NET is behind when it comes to delegates!
0
Mike TomlinsonHigh School Computer Science, Computer Applications, and Mathematics TeachersCommented:
Is that a third-party checkbox control?...

Anyhoo, using a Standard .Net CheckBox, I'll illustrate with this:
Public Class Form1
 
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        AddHandler Me.chkManageDragging.CheckedChanged, AddressOf Me.chkManageDragging_CheckedChanged
    End Sub
 
    Private Sub chkManageDragging_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs
        Me.dragMgr.ListView = Me.listView
    End Sub
 
End Class

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ALawrence007Author Commented:
Thanks Idle_Mind.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.