Results 1 to 6 of 6

Thread: ComboBox / Auto Complete Help

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2012
    Posts
    440

    ComboBox / Auto Complete Help

    I have a WinForm with about 50 fields on it. On this form I want to select a Student from a List<Student> to form a new group of people.

    My Student List is about 20,000 long. I've done the first couple as a test and made the DataSource the list. I have two issues

    1. When the same list is bound to two combo boxes, when I update the other updates as well
    2. The form is slow to load. The list is being populated on form load. Its being loaded from an SQLite, so not that slow itself but the more comboboxs I load the slower it gets.

    What other ways can I do this?

  2. #2

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2012
    Posts
    440

    Re: ComboBox / Auto Complete Help

    Yeah I like that idea, I could have textbox's instead of combobox. Make them readonly.

    On enter I should display and panel with a single combobox. On selection I return the Student object.

    How can I send my calling textbox to the combobox so its returned and populated in the correct one?

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2012
    Posts
    440

    Re: ComboBox / Auto Complete Help

    On focus of a text box I do this to show the panel and Combo Box
    Code:
    Private Sub onEnter(ByVal sender As Object, ByVal e As EventArgs)
        panel1.Visible = True
        comboBox1.Focus()
    End Sub
    When I loose focus or click a button I want to return the Student to the calling textbox. I want to reuse this code for all 50 textbox's. Text will be Student Name and Tag will be the student ID number to keep it unique.

    Code:
    Private Sub returnStudent(ByVal sender As Object, ByVal e As EventArgs)
        Dim s = TryCast(comboBox1.SelectedItem, Student)
    End Sub
    The issue is how to do I return the student to calling textbox?

    I guess I'll need to place this into a function of some sort as well.

  4. #4
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    25,949

    Re: ComboBox / Auto Complete Help

    To avoid the synchronizing issue, bind both ComboBoxes to [yourObject].Clone

  5. #5

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2012
    Posts
    440

    Re: ComboBox / Auto Complete Help

    Right, is it not possible to do it my way. Enter a textbox, call a function that shows a panel with a single combobox and put the focus on it. (I can do that part).

    But on a button click return the Student object to the calling textbox (can't do that part)

  6. #6

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2012
    Posts
    440

    Re: ComboBox / Auto Complete Help

    Sorry, it has changed a little from the start.

    I have a form with room for 50 students to be loaded with some other unique data that'll be filled out for each student when they're loaded. I have a List<Student> which is about 20,000 long and all unique.

    I want to fill in about 50 Students into the form capturing the Student ID and some extra info studentId_One_code.Text for example would capture the first Students unique code they've been given.

    The issue have is I want to use the same List<Student> to fill in the 50 spaces for students on my form. Binding the list to a combobox to each makes it super slow. So I thought about having one combobox and sending back the name and ID to calling textbbox (called when a user tabs into the textbox field)

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