i have a project my next task is to display the item selected from my listview to the textbox in the other form
heres my code on the listview
Public Class listemployee
Private Sub listemployee_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
' Create the column headers.
ListView2.Columns.Add("EmployeeID", _
HorizontalAlignment.Left)
ListView2.Columns.Add("LastName", _
HorizontalAlignment.Left)
ListView2.Columns.Add("FirstName", _
HorizontalAlignment.Left)
ListView2.Columns.Add("MiddleName", _
HorizontalAlignment.Right)
ListView2.Columns.Add("Birthday", _
HorizontalAlignment.Left)
ListView2.Columns.Add("Address", _
HorizontalAlignment.Right)
ListView2.Columns.Add("EmailAddress", _
HorizontalAlignment.Right)
ListView2.Columns.Add("Contact#", _
HorizontalAlignment.Right)
ListView2.Columns.Add("CivilStatus", _
HorizontalAlignment.Left)
ListView2.Columns.Add("Religion", _
HorizontalAlignment.Right)
ListView2.Columns.Add("SSSId", _
HorizontalAlignment.Right)
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnloaddata.Click
Dim dr As OleDb.OleDbDataReader
ListView2.Items.Clear()
Call connecttodb()
cmd.CommandText = "SELECT * FROM tblemployee ORDER BY EmployeeID"
dr = cmd.ExecuteReader()
'Stop
Do While dr.Read()
Dim new_item As New _
ListViewItem(dr.Item("EmployeeID").ToString)
new_item.SubItems.Add(dr.Item("LastName").ToString)
new_item.SubItems.Add(dr.Item("FirstName").ToString)
new_item.SubItems.Add(dr.Item("MiddleName").ToString)
new_item.SubItems.Add(dr.Item("Birthday").ToString)
new_item.SubItems.Add(dr.Item("Address").ToString)
new_item.SubItems.Add(dr.Item("EmailAddress").ToString)
new_item.SubItems.Add(dr.Item("Contact#").ToString)
new_item.SubItems.Add(dr.Item("CivilStatus").ToString)
new_item.SubItems.Add(dr.Item("Religion").ToString)
new_item.SubItems.Add(dr.Item("SSSId").ToString)
ListView2.Items.Add(new_item)
Loop
Call disconnecttodb()
End Sub
Private Sub ListView2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles ListView2.Click
txt1.Text = ListView2.SelectedItems.Item(0).Text
End Sub
Private Sub btnselect_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnselect.Click
Dim dr As OleDb.OleDbDataReader
If txt1.Text = ListView2.SelectedItems.Item(0).Text Then
Call connecttodb()
cmd.CommandText = "SELECT * FROM tblemployee ORDER BY EmployeeID"
dr = cmd.ExecuteReader()
Do While dr.Read()
'txtempid.Text = txt1.Text
'txtlast.Text = dr("LastName").ToString
'txtfirst.Text = dr("FirstName").ToString
'txtmid.Text = dr("MiddleName").ToString
'txtaddress.Text = dr("Address").ToString
'dtbday.Text = Format(CDate(dr("Birthday").ToString), "MM/dd/yyyy")
'txtemail.Text = dr("EmailAddress").ToString
'txtcontact.Text = dr("Contact#").ToString
'cbostat.Text = dr("CivilStatus").ToString
'cboreligion.Text = dr("Religion").ToString
'txtsss.Text = dr("SSSId").ToString
Loop
Call disconnecttodb()
End If
End Sub
End Class
the items in the listview should be display in the textboxes in the other form whenever i click select data
help please...