Posted on 2006-04-22
Last Modified: 2010-04-23
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.
Question by:VBdotnet2005
    LVL 6

    Expert Comment

    LVL 5

    Accepted 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

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
    Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
    It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
    Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

    761 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    9 Experts available now in Live!

    Get 1:1 Help Now