Hi,

When I tried to create a global variable of type sqlConnection and sqlDataAdapter, vb 2005 underlines it and says that the "type is not defined".

The 2 declarations are:

Dim myConnection As SqlConnection = New SqlConnection(..........)
Dim myAdapter As SqlDataAdapter = New SqlDataAdapter(......,....)

When they are added as global variables (outside of any private sub), vb 2005 highlights sqlConnection and sqlDataAdapter as errors. But when they are added inside a private sub procedure, like Private Sub Form1_Load, then there is no error.

How come they cant be global variables? I need them to be freely accessed by the various Private Sub procedure inside the Form1 public class.