Click here to Skip to main content
15,606,617 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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");

                 if (_gui.Controls.ContainsKey("back"))
                     _gui.Controls["back"].Tapped += (s, v) => { if (PrevScreen != null) Manager.TransitionTo(PrevScreen); };

                 _renderer = new RenderEngine();
                 _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")

        If _gui.Controls.ContainsKey("back") Then
            _gui.Controls("back").Tapped += Function(s, v) Do
                If PrevScreen IsNot Nothing Then
                End If
            End Function
        End If

        _renderer = New RenderEngine()
        _renderer.LoadGraphics(c, device)

        _sb = New SpriteBatch(device)

        IsLoaded = True
    End Function)
End Sub

1 solution

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