Results 1 to 10 of 10

Thread: [2005] Search and textboxes

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2007
    Posts
    258

    [2005] Search and textboxes

    I have a form and im planning on putting a search textbox wherein once i input the ID number of the employee, all the textboxes in the form that displays the information of the employee will also change, so far i can only do this through move next , move first , move last, move previous buttons.

  2. #2
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: [2005] Search and textboxes

    What is the problem?

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2007
    Posts
    258

    Re: [2005] Search and textboxes

    i need to know the codes on how to make a textbox display the corresponding records in the form..

    so the searchtextbox is where i will put an employee number and then all the other textboxes with employee recordss.. (employee name, emplyoee tel..) will also change to the data corresponding to the employeeID number

  4. #4
    PowerPoster sparrow1's Avatar
    Join Date
    May 2005
    Location
    Globetrotter
    Posts
    2,820

    Re: [2005] Search and textboxes

    Quote Originally Posted by aerialz666
    i need to know the codes on how to make a textbox display the corresponding records in the form..

    so the searchtextbox is where i will put an employee number and then all the other textboxes with employee recordss.. (employee name, emplyoee tel..) will also change to the data corresponding to the employeeID number
    Hi,

    Can't you use a Auto-Complete combobox and if the ID is found put all the records into your textBoxes.

    Wkr,

    sparrow1
    Wkr,
    sparrow1

    If I helped you, don't forget to Rate my post. Thank you

    I'm using Visual Studio.Net 2003 and
    2005
    How to learn VB.Net Create setup with VB 2005 Drawing for beginners VB.Net Tutorials GDI+ Tutorials
    Video's for beginners

  5. #5

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2007
    Posts
    258

    Re: [2005] Search and textboxes

    Hi can you teach me how to do it sparrow? what to put on auto complete and a sample of moving the records corresponding to the ID number

  6. #6
    PowerPoster sparrow1's Avatar
    Join Date
    May 2005
    Location
    Globetrotter
    Posts
    2,820

    Re: [2005] Search and textboxes

    Quote Originally Posted by aerialz666
    Hi can you teach me how to do it sparrow? what to put on auto complete and a sample of moving the records corresponding to the ID number
    Hi,

    Here's an exmple how to use a auto-complete combobox.
    I'll have to tell you that I made this with a TextBox.

    Code:
    Private ControlKey As Boolean = False
        Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            ComboBox1.Items.Add("Zebra")
            ComboBox1.Items.Add("Monkey")
            ComboBox1.Items.Add("Fly")
            ComboBox1.Items.Add("Spider")
            ComboBox1.Items.Add("Crocodil")
            ComboBox1.Items.Add("Tiger")
            ComboBox1.Items.Add("Lion")
            ComboBox1.Items.Add("Airplane")
            ComboBox1.Items.Add("Boot")
            ComboBox1.Items.Add("Sea cow")
    
        End Sub
    
        Private Sub ComboBox1_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ComboBox1.TextChanged
            Dim Combo As ComboBox = CType(sender, ComboBox)
            If Combo.Text <> "" And Not ControlKey Then
                Dim MatchText As String = Combo.Text
                Dim Match As Integer = Combo.FindString(MatchText)
                If Match <> -1 Then
                    Combo.SelectedIndex = Match
                    Combo.SelectionStart = MatchText.Length
                    Combo.SelectionLength = Combo.Text.Length -           Combo.SelectionStart
                    TextBox1.Text = ComboBox1.Text
                If ComboBox1.SelectedIndex Then
                    TextBox1.Text = ComboBox1.Text
                End If
            End If
            End If
        End Sub
    
        Private Sub ComboBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles ComboBox1.KeyPress
            Dim Combo As ComboBox = CType(sender, ComboBox)
            If Asc(e.KeyChar) = Keys.Escape Then
                Combo.SelectedIndex = -1
                Combo.Text = ""
                ControlKey = True
            ElseIf Char.IsControl(e.KeyChar) Then
                ControlKey = True
            Else
                ControlKey = False
            End If
        End Sub
    Hope it will guide you into the proper direction.

    Wkr,

    sparrow1
    Wkr,
    sparrow1

    If I helped you, don't forget to Rate my post. Thank you

    I'm using Visual Studio.Net 2003 and
    2005
    How to learn VB.Net Create setup with VB 2005 Drawing for beginners VB.Net Tutorials GDI+ Tutorials
    Video's for beginners

  7. #7

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2007
    Posts
    258

    Re: [2005] Search and textboxes

    thanks, i tried a select statement in the combobox and its now working, the problem is that, the department names listed is repeating ex.

    here are the items in the CBO

    CA
    HRM
    IT
    CA
    HRM
    IT
    CA
    HRM
    IT

    --

    i only have 3 different departments, but in the combobox at run time it shows multiple items that are the same as the original 3. what should i add or do so that there will be no duplicate items shown in the cbo thanks

  8. #8
    PowerPoster sparrow1's Avatar
    Join Date
    May 2005
    Location
    Globetrotter
    Posts
    2,820

    Re: [2005] Search and textboxes

    Hi,

    How do you add the items into your combobox?

    Wkr,

    sparrow1
    Wkr,
    sparrow1

    If I helped you, don't forget to Rate my post. Thank you

    I'm using Visual Studio.Net 2003 and
    2005
    How to learn VB.Net Create setup with VB 2005 Drawing for beginners VB.Net Tutorials GDI+ Tutorials
    Video's for beginners

  9. #9

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2007
    Posts
    258

    Re: [2005] Search and textboxes

    well i call an SQL statement.. Select DepartmentName from DepartmentList

  10. #10
    PowerPoster sparrow1's Avatar
    Join Date
    May 2005
    Location
    Globetrotter
    Posts
    2,820

    Re: [2005] Search and textboxes

    Quote Originally Posted by aerialz666
    well i call an SQL statement.. Select DepartmentName from DepartmentList
    Hi,

    Here's previous thread about diplication in a combobox.

    http://www.vbforums.com/showthread.p...items+combobox

    Hope it helps,

    sparrow1
    Wkr,
    sparrow1

    If I helped you, don't forget to Rate my post. Thank you

    I'm using Visual Studio.Net 2003 and
    2005
    How to learn VB.Net Create setup with VB 2005 Drawing for beginners VB.Net Tutorials GDI+ Tutorials
    Video's for beginners

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width