Quantcast
Channel: VBForums
Viewing all articles
Browse latest Browse all 42732

VS 2010 Consult with Primary Key in a DataGrid Textbox

$
0
0
Hello everyone good morning?
Would you like some help on how to make an appointment with a DataGrid textbox using the filter to type in the textbox.
Use this form here tried but failed. Could someone pass me a solution?

Code:


//Code that lists all contacts in the Form
  Public Sub AllContact(ByVal resul As Boolean)

        'Dim cliente As New Customers()
        Dim objContact As New DALContact()

        Try

            Dim ds As DataSet = objContact.AllContact()

            Dim dt As DataTable = ds.Tables(0)
       
            dv = dt.DefaultView

         
            If ds.Tables(0).Rows.Count > 0 Then

                With dv
                    .AllowNew = False
                    .AllowDelete = False
                    .AllowEdit = False
                    .Sort = " Pes_contact_Nome ASC "

                End With



                gvContact.DataSource = dv
                bs.DataSource = ds
               
            End If

        Catch ex As Exception
            MessageBox.Show(ex.Message)

              End Try


    End Sub



//Code Textbox
Private Sub txtSearchCustomers_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtBuscaClientes.TextChanged

        Try

            Dim txtstring As String = Me.txtSearchCustomers.Text

            If rdbIDCustomers.Checked = True Then


                Dim dv As DataView = Me.gvContact.DataSource
                dv.RowFilter = "Pes_contact_ID LIKE '" & txtstring & "%'"
                Me.gvContact.DataSource = dv

       
            End If


        Catch ex As Exception
            Throw ex
        End Try


    End Sub


Viewing all articles
Browse latest Browse all 42732

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>