Monday, 8 February 2021

Working with DataGridView in VB.NET

 If you're completely unfamiliar with VB.NET and the DataGridView and you find yourself tasked with adding a data grid to a VB.NET application, using SQL Server, here is what to do:

  • Open the solution
  • Create a new form, if you need to, by right-clicking Project and clicking New Form
  • Draw a DataGridView on the form using the tool in the Tools menu.
  • Click the little arrow in the top right and select your data source, or create a new one.
  • To create a new data source simply connect to your database and select the tables you want.
  • Then back on the form, click the Data Grid View and change the DataSource property to the binding that got automatically created when you added the data grid view.
  • Then in DataMember, select the table you want the grid to show.