Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 723
  • 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
 
jpaulinoCommented:
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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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