Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: VB.NET
I have coverted the following code from C# using a online converter but can't seem to get it working. I get multiple errors. 'Expression Expected' for the Do, 'C is not declared', Missing Endif, 'Public event Tapped cannot be called directly'. Can anyone provide the proper VB code or any suggestions?

The Original C# code:
 
public void LoadGraphics(GraphicsDevice device)
     {
         _bg.BeginLoad(c =>
             {
                 _gui = c.Load<Window>(@"Data\GUI\Options");
                 RegisterInput();
 
                 if (_gui.Controls.ContainsKey("back"))
                     _gui.Controls["back"].Tapped += (s, v) => { if (PrevScreen != null) Manager.TransitionTo(PrevScreen); };
 
                 _renderer = new RenderEngine();
                 _gui.RegisterVisuals(_renderer);
                 _renderer.LoadGraphics(c, device);
 
                 _sb = new SpriteBatch(device);
 
                 IsLoaded = true;
             });
     }
 

The Coverted VB code:
 
Public Sub LoadGraphics(device As GraphicsDevice)
    _bg.BeginLoad(Function(c) Do
        _gui = c.Load(Of Window)("Data\GUI\Options")
        RegisterInput()
 
        If _gui.Controls.ContainsKey("back") Then
            _gui.Controls("back").Tapped += Function(s, v) Do
                If PrevScreen IsNot Nothing Then
                    Manager.TransitionTo(PrevScreen)
                End If
            End Function
        End If
 
        _renderer = New RenderEngine()
        _gui.RegisterVisuals(_renderer)
        _renderer.LoadGraphics(c, device)
 
        _sb = New SpriteBatch(device)
 
        IsLoaded = True
    End Function)
End Sub
Posted 8-Dec-12 12:37pm

1 solution

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

  Print Answers RSS
0 OriginalGriff 240
1 Kamal Rocks 184
2 BillWoodruff 173
3 Sergey Alexandrovich Kryukov 170
4 PIEBALDconsult 160
0 OriginalGriff 5,695
1 DamithSL 4,506
2 Maciej Los 4,007
3 Kornfeld Eliyahu Peter 3,480
4 Sergey Alexandrovich Kryukov 3,180


Advertise | Privacy | Mobile
Web02 | 2.8.141216.1 | Last Updated 9 Dec 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100