-
Feb 15th, 2025, 01:45 PM
#1
Thread Starter
Hyperactive Member
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?
-
Feb 15th, 2025, 06:16 PM
#2
Thread Starter
Hyperactive Member
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?
-
Feb 15th, 2025, 10:59 PM
#3
Thread Starter
Hyperactive Member
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.
-
Feb 16th, 2025, 11:30 AM
#4
Re: ComboBox / Auto Complete Help
To avoid the synchronizing issue, bind both ComboBoxes to [yourObject].Clone
- Coding Examples:
- Features:
- Online Games:
- Compiled Games:
-
Feb 16th, 2025, 11:48 PM
#5
Thread Starter
Hyperactive Member
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)
-
Feb 17th, 2025, 09:36 PM
#6
Thread Starter
Hyperactive Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|