If you are using this inside an event, you will already have 'e' declared at the top.

Change the e to ex

Code:
Catch ex As Exception
    MessageBox.Show("Failed to connect: " & ex.ToString, "Error")