(I have checkboxes in my listview(lvContact) ... this code is working by selecting the full row. But I want to use checkbox and highlight the full row.. can anyone help me.. )
"Sorry for my bad english"
here is the code:
Private Sub btnEdit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnEdit.Click
If lvContact.SelectedItems(0).Text = False Then
MsgBox("Please Choose a Record to edit.", MsgBoxStyle.Exclamation)
Else
Dim sqlQuery As String = "SELECT First_Name, Middle_Name, Last_Name, Cell_No FROM Contact_Table WHERE ID = '" & lvContact.SelectedItems(0).Text & "'"
Dim sqlAdapater As New SqlDataAdapter
Dim sqlCommand As New SqlCommand
Dim TABLE As New DataTable
With sqlCommand
.CommandText = sqlQuery
.Connection = sConnection
End With
With sqlAdapater
.SelectCommand = sqlCommand
.Fill(TABLE)
End With
FormEdit.ID = lvContact.SelectedItems(0).Text
FormEdit.First_Name = TABLE.Rows(0)("First_Name")
FormEdit.Middle_Name = TABLE.Rows(0)("Middle_Name")
FormEdit.Last_Name = TABLE.Rows(0)("Last_Name")
FormEdit.Cell_No = TABLE.Rows(0)("Cell_No")
FormEdit.ShowDialog()
End If
End Sub
"Sorry for my bad english"
here is the code:
Private Sub btnEdit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnEdit.Click
If lvContact.SelectedItems(0).Text = False Then
MsgBox("Please Choose a Record to edit.", MsgBoxStyle.Exclamation)
Else
Dim sqlQuery As String = "SELECT First_Name, Middle_Name, Last_Name, Cell_No FROM Contact_Table WHERE ID = '" & lvContact.SelectedItems(0).Text & "'"
Dim sqlAdapater As New SqlDataAdapter
Dim sqlCommand As New SqlCommand
Dim TABLE As New DataTable
With sqlCommand
.CommandText = sqlQuery
.Connection = sConnection
End With
With sqlAdapater
.SelectCommand = sqlCommand
.Fill(TABLE)
End With
FormEdit.ID = lvContact.SelectedItems(0).Text
FormEdit.First_Name = TABLE.Rows(0)("First_Name")
FormEdit.Middle_Name = TABLE.Rows(0)("Middle_Name")
FormEdit.Last_Name = TABLE.Rows(0)("Last_Name")
FormEdit.Cell_No = TABLE.Rows(0)("Cell_No")
FormEdit.ShowDialog()
End If
End Sub