The Article Demonstrate the how to change the DataSource Property of DataGridView Dynamically.
- ComboBox Control
- DataGridView Control
- The method is so easy to handle.
- Here, I am taken an XML file as DataBase file.
- The Article shows displaying data into DataGridView Control of table name selected from the ComboBox Control.
- Create a new instance of the System.Data.DataSet class.
- Now, on the Form_Load event handler read an XML file using DataSet Object.
- Then add all the TableName avail in the DataSet Object to the ComboBox items collection. Result is displayed in Figure 1.
- After this, set the DataSource property of DataGridView to the selected item of ComboBox.