• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 730
  • Last Modified:

How to focus a particular column in a datagridview using VB.NET 2005

Hello Experts,
If I click a button, Then It focuses into a particular column in  a datagridview using VB.NET 2005.
I don't know , How to do it. please help me out
Thanks in advance
0
zillion_kamesh
Asked:
zillion_kamesh
1 Solution
 
Jorge PaulinoIT Pro/DeveloperCommented:
This will select the first cell in the second column
Me.DataGridView1.CurrentCell = Me.DataGridView1(1, 0)

Open in new window

0
 
udaydidigamCommented:
In VB.NET:

Focus a particular cell:

Me.DataGridView1.Rows(0).Cells(0).Selected = true
Me.DataGridView1.SelectionMode = DataGridViewSelectionMode.CellSelect

Focus a particular column:
      Me.DataGridView1.SelectionMode = DataGridViewSelectionMode.FullColumnSelect
      Me.DataGridView1.Columns(1).Selected = True

Note: When using FullColumnSelect mode, it doesn't allow SortMode of any one column to be set to Automatic

Focus a particular row:
     Me.DataGridView1.SelectionMode = DataGridViewSelectionMode.FullRowSelect
     Me.DataGridView1.Rows(1).Selected = True
0

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now