• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 142
  • Last Modified:


I have four textboxes : txtClientId, txtAccountNumber, txtPhoneNum, txtFormNum.
I want to retrieve info. from my SQL database and and fill these textboxes. I want a user to enter ClientId(txtClientId), sample, "S14523", and click a btnGet, to retreived info.
1 Solution
The links hatem72 supplied are good examples of how to bind data.  If you need to search on your textbox (txtClientId) as opposed to a combobox you can use something like this:

Private Sub btnGet_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnGet.Click

        Dim dv As DataView = yourDataSet.Tables(0).DefaultView

 If tbSearch.Text = "" Then
            MessageBox.Show("Enter Search Criteria", "Your Project", MessageBoxButtons.OK, MessageBoxIcon.Information)
            Exit Sub
 End If
        dv.RowFilter = " ClientId LIKE '%" + txtClientId.Text + "%' "

 If dv.Count < 1 Then
            MessageBox.Show("No records found.", "Your Project", MessageBoxButtons.OK, MessageBoxIcon.Information)
End if

End Sub

Private Sub txtClientId_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtClientId.KeyPress
        If Convert.ToInt32(e.KeyChar) = Keys.Enter Then
            Call btnGet_Click(Me, e)
            e.Handled = True
        End If
    End Sub

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now