Solved

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

Posted on 2009-06-28
2
620 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
2 Comments
 
LVL 48

Accepted Solution

by:
jpaulino earned 250 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 Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

For most people, the WrapPanel seems like a magic when they switch from WinForms to WPF. Most of us will think that the code that is used to write a control like that would be difficult. However, most of the work is done by the WPF engine, and the W…
For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
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…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

747 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now