Database operations in DatagridView
The DataGridView control offers the capability to present rows of data obtained from a data source. It provides three distinct modes for displaying data: Bound mode, unbound mode, and Virtual mode.
Bound mode is particularly useful when dealing with large datasets and seamless interaction with the underlying data store. By binding the DataGridView control to a table in a database, you can effortlessly manage and manipulate the data through automatic synchronization. This mode is commonly employed when working with extensive databases or when there is a need for real-time updates and synchronization between the DataGridView and the data source.
On the other hand, unbound mode is well-suited for showcasing smaller amounts of data that you can manually manage and manipulate programmatically. It allows you to populate the DataGridView control directly with data that you generate or retrieve from various sources, such as in-memory collections or custom data structures. This mode offers more flexibility in terms of data manipulation and presentation, making it suitable for scenarios where you have control over the data and its display.
Virtual mode, as the name suggests, provides a heightened level of control over the data display. It allows you to dynamically provide the values for each cell as they are being displayed on the screen. Instead of preloading all the data into the DataGridView control, virtual mode enables you to wait until a specific cell is being rendered before determining its value. This mode is advantageous when dealing with extensive datasets or when the data retrieval process is resource-intensive, as it offers a more efficient and responsive user experience.
By offering these distinct modes, the DataGridView control caters to various data presentation and manipulation requirements, providing developers with the flexibility to choose the most suitable mode based on the size of the dataset, the level of control desired, and the interaction with the data source.
The following vb.net source code illustrate how to connect a DataGridView to a database and addnew/update or delete the database values from DataGridView.Full Source VB.NET