How to Select a Cell in a DataGridView

Written by jaime avelar | 13/05/2017

Knowing how to select a cell in Data Grid View control using Microsoft Visual Basic.NET can make your Windows applications more user-friendly. You use a Grid control to show data in a tabular format similar to a table. You can use it to show small or large amounts of data. VB.NET is an object-oriented computer programming language you can use to create Windows applications. In a few steps, you can create a VB.NET project, and use a Grid control to display data and select an individual cell.

Start Microsoft Visual Basic Express. Click "New Project..." on the left-hand pane of your screen and select "Windows Forms Application." Click "OK."

Double-click "Button" on the "Toolbox" pane to add a new button control. Double-click "DataGridView" to add a new grid control. Double-click "Button1" to open the "Form1.vb" module.

Type the following text to define the number of columns and define the column names of the Data Grid View control:

DataGridView1.ColumnCount = 3

Type the following text to load data to the Data Grid View control:

Type the following text to select the last cell in the second row:

Press "F5" to run your program and click "Button1" to load data and select the last cell in the second row.

Things you need

  • Microsoft Visual Basic Express

Show MoreHide

By using the eHow.co.uk site, you consent to the use of cookies. For more information, please see our Cookie policy.