problem with visualbasic 2010 coding

PaulS, here is the declaration for the serialport1.

Public Class Form1
Dim voltage As Integer
Dim WithEvents longitude As SerialPort = New _
System.IO.Ports.SerialPort("COM23", 9600, Parity.None, 8, StopBits.One)

however, i still get the same error " system.InvalidOperationException ".