|
-
Nov 8th, 2006, 03:37 PM
#1
Thread Starter
New Member
List Box from Combo Box
Hi,
I have a program w/ a DB backend. What I would like to do is fill a listbox based on the selection of the combo box.
In addition I would like to have two text boxes .text values based on the listbox selection.
I understand it's based on
VB Code:
ProjectList_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ProjectList.SelectedIndexChanged
(ProjectList being my combobox) but not sure how to fill the listbox based on this change.
Thanks
Last edited by RobDog888; Nov 8th, 2006 at 04:34 PM.
Reason: Added [vbcode] tags
-
Nov 8th, 2006, 04:35 PM
#2
Re: List Box from Combo Box
There's no need to handle any events at all. Proper data binding will handle all the control updating for you. I'm not going to say more until you specify which version you're using because the details will be different for each. There are radio buttons provided when you create a thread. Please use them.
-
Nov 8th, 2006, 04:37 PM
#3
Re: List Box from Combo Box
Is your listbox databound or are you manually populating it in a loop?
You would need to, rebind a new datasource or repopulate in the loop, passing the new sql query with the combo box selection as part of the where clause to filter the results as your user selected
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Nov 8th, 2006, 04:37 PM
#4
Re: List Box from Combo Box
In the SelectedIndexChanged event of the ComboBox, you need to connect to the database and query for data that match whatever the combobox's selected item means.
Once you have the data, just bind it to to the listbox.
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
|