Thank you for your input I am going to paste my code here, if you could see whats wrong.
#Region " .... dbconn .... "
Dim strSQL As String
Dim con As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Application.StartupPath & "/TEST.mdb; Persist Security Info=False;"
Dim oledbcon As New OleDbConnection(con)
Dim cmd As OleDbCommand
Dim objRead As OleDbDataReader
Dim lvItem As ListViewItem = New ListViewItem
#End Region
#Region " .... getdata .... "
Private Sub fetching()
Me.ListView1.Items.Clear()
Try
strSQL = "SELECT * FROM class"
cmd = New OleDbCommand(strSQL, oledbcon)
objRead = cmd.ExecuteReader
While objRead.Read
lvItem = Me.ListView1.Items.Add(objRead("ClassID") & "")
lvItem.SubItems.Add(objRead("ClassDescription") & "")
lvItem.SubItems.Add(objRead("ClassDate") & "")
End While
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End Sub
#End Region
#Region " .... load event .... "
Public Sub frmClass_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
oledbcon.Open()
fetching()
oledbcon.Close()
End Sub
#End Region
Public Sub btnAddClass_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAddClass.Click
Dim frmPOP As New frmAddClass
frmPOP.ShowDialog()
End Sub
Public Sub ListView1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListView1.SelectedIndexChanged
End Sub
Public Sub btnViewRoster_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnViewRoster.Click
If ListView1.SelectedIndices.Count = 0 Then
MsgBox("Please Select a Class Before Moving On.", MsgBoxStyle.OKOnly, "Select Class")
Else
Dim classvalue As Long = Me.ListView1.SelectedItems(0).Text
Dim frmRos As New frmRoster
frmRos.ShowDialog()
End If
End Sub
I am also trying to pass the data in "classvalue" to a new form, if you have any insight on that it would be very much appreciated.
Thanks alot