We can use the Load event to add a data source to our first combobox. To make our example more straight-forward, let’s say that the first combobox contains the names of all salespersons, working in a company. Once a person is chosen in the first combobox, the second combo will get updated with the client accounts this person is responsible for. In other words, the first combobox is used to filter client accounts.
Initially, you need to create a new server connection from the Server Explorer in Visual Studio and then you need to add your Link to SQL classes template from the context menu in the Solution Explorer:
The next step is to query for all salespersons in say Form_Load event:
When the selected value member of the first combobox is changed the second combobox is populated accordingly:
I hope this post covers the basics when working with LINQ and you can now start working and enjoying LINQ in WinForms as well!
I will greatly appreciate your comments. Do you folks use LINQ in your applications?
Copyright © 2016, Progress Software Corporation and/or its subsidiaries or affiliates. All Rights Reserved.
Progress, Telerik, and certain product names used herein are trademarks or registered trademarks of Progress Software Corporation and/or one of its subsidiaries or affiliates in the U.S. and/or other countries. See Trademarks or appropriate markings.