Carol Markham

Carol Markham

  • NA
  • 1
  • 2.9k

Converting from C# to VB problem

Nov 17 2010 8:34 AM

Hi,
I am converting a mobile app from C# to VB. My problem is with clicking on a menuItem.
The original C# code for the _Click is as follows:
        private void mnuItmQuit_Click(object sender, EventArgs e)
        {
            Application.Exit();
        }

Which I have converted as this:
Private Sub mnuItmQuit_Click(ByVal sender As Object, ByVal e As EventArgs)

Application.[Exit]()
End Sub
Further down the generated Forms code for mnuItmQuit is:
Me.mnuItmQuit.Text = "Quit"
Me
.mnuItmQuit.Click += New System.EventHandler(AddressOf Me.mnuItmQuit_Click)
However, I get this error: "Public Event Click(sender As Object, e As System.EventArgs" is an event and cannot be called directly. Use a RaiseEvent statement to raise an event.
At this point, I'm lost and have no idea where or how to do the RaiseEvent.
Thanks in advance. 

Answers (2)