Search and fill the textbox

0 Nathan Moland · May 6, 2015
I have this program I want to search a data then if i have the record or data it would fill the corresponding textboxes with its value. How can i code that? im using mysql server. PLEASE HELP/images/forum/upload/2015-05-06/3376d71ab55d5a27540f311438c7bf8a.png

Post a Reply

Replies

Oldest  Newest  Rating
0 mike richardson · May 6, 2015
If you are using a dataset or datatable then its easy.

textbox.text = nameofyourdataset.Rows(0)("Column Name")
0 Nathan Moland · May 7, 2015
LIKE THIS?

    Private Sub txtSEARCH_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtSEARCH.TextChanged

        Try
            If Not dataCNN.State = ConnectionState.Open Then

                dataCNN.Open()
            End If
            DA = New MySqlDataAdapter("SELECT * FROM pelcoisd.recon where Name like '%" & Me.txtSEARCH.Text & "%' or AccountNumber like '" & Me.txtSEARCH.Text & "%' or Serial LIKE '" & Me.txtSEARCH.Text & "' LIMIT 0, 100", dataCNN)
            DT = New DataTable
            DA.Fill(DT)


            'dgvSample.DataSource = DT
            'dgvAPPLICANTLIST.AutoResizeColumns()
            txtNAME.Text = DT.Rows(0)("Name")
            txtACCOUNT.Text = DT.Rows(0)("AccountNumber")
            txtRB.Text = DT.Rows(0)("RoverBook")
            txtADDRESS.Text = DT.Rows(0)("Address")
            txtSERIAL.Text = DT.Rows(0)("Serial")


            dataCNN.Close()

        Catch ex As MySqlException
            MessageBox.Show(ex.Message)
            dataCNN.Close()
            Exit Sub
        End Try
    End Sub
0 mike richardson · May 8, 2015
Yes. 
  • 1

Visual Basic

107,326 followers
About

One of the first products to provide a graphical environment and a paint metaphor for developing user interfaces.

Links
Moderators
Bucky Roberts Administrator