Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2009-06-28
2
Medium Priority
?
711 Views
Last Modified: 2013-11-26
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
Comment
Question by:zillion_kamesh
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 48

Accepted Solution

by:
jpaulino earned 1000 total points
ID: 24734080
This will select the first cell in the second column
Me.DataGridView1.CurrentCell = Me.DataGridView1(1, 0)

Open in new window

0
 
LVL 4

Expert Comment

by:udaydidigam
ID: 24734226
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: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

After several hours of googling I could not gather any information on this topic. There are several ways of controlling the USB port connected to any storage device. The best example of that is by changing the registry value of "HKEY_LOCAL_MACHINE\S…
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question