ADO.Net architechture
ADO.Net architechture
A ComboBox is a graphical user interface (GUI) control that allows users to select a single item
from a drop-down list. It can also allow users to enter a custom value if the DropDownStyle is
set to DropDown.
using System;
using System.Data;
using System.Data.SqlClient;
using System.Windows.Forms;
1. DataSource: Binds the data retrieved from the database to the ComboBox.
2. DisplayMember: Specifies the column (DeptName) to display in the ComboBox.
3. ValueMember: Specifies the column (DeptID) that acts as the underlying value for each item.
Result:
The cmbDept ComboBox will be filled with department names from the TBLDEPT table.
Each item in the ComboBox will have:
o Displayed text: DeptName.
o Associated value: DeptID.
Let me know if you need further clarification or enhancements!