Scenario: You are developing a WinForms application that needs to display a list of products from a database. Which control and data binding method would you use to achieve this?
- DataGridView with DataSource property
- ListBox with DataBinding event
- ComboBox with DisplayMember property
- DataGrid with Bind method
The correct option is DataGridView with DataSource property. DataGridView is a versatile control for displaying tabular data and supports data binding through its DataSource property, which allows you to easily bind it to a data source such as a DataTable or a list of objects. This control provides rich functionality for displaying and editing data in a grid format, making it suitable for displaying a list of products from a database.
Loading...
Related Quiz
- What does LINQ stand for in the context of C# and .NET?
- Scenario: Your application requires real-time updates of data in the UI whenever changes occur in the database. Which type of data binding would be suitable for this scenario, and why?
- What are the advantages of using connection pooling in ADO.NET?
- Which method is used to advance the data reader to the next record in the result set?
- In Entity Framework, you can improve performance by using ___________ for executing raw SQL queries.