Sathya Narayan

Sathya Narayan

  • NA
  • 155
  • 63.8k

To Search The listview item from combobox

Jul 16 2014 8:23 AM
Hi,

I am using listview and combobox to search the value from combobox,how could i filter the values using combobx .Here is the code i am using.

Values Filled To Combobox

        FillCombobox(ComboBox1, "Select slno,custname,address,tinno,cstno from tbl_custinfo", "custname", "custname", "custname")

Listview Filled

Public Sub FillList1()
        sSql = "Select slno,custname,address,tinno,cstno from tbl_custinfo"

        With lstcust
            .Clear()
            .View = View.Details
            .FullRowSelect = True
            .GridLines = True
            .Columns.Add("SLNO", 0)
            .Columns.Add("Customer Name", 290)
            .Columns.Add("Address", 500)
            .Columns.Add("Tin No", 103)
            .Columns.Add("Customer No", 125)
            FillListView(lstcust, GetData(sSql))
        End With
    End Sub

Used To filter by combobox

 Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
        sSql = "Select slno,custname,address,tinno,cstno from tbl_custinfo where stu='A' and custname Like '" & ComboBox1.Text.Replace("'", "''") & "%'"
        If lstcust.Items.Count = 0 Then
            Call FillList1()
            MsgBox("Selected Records Not Found")
        ElseIf lstcust.Items.Count > 0 Then
        End If

    End Sub

Can any one help?



Answers (1)