473,385 Members | 1,764 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Select Row in DataGridView

GS
Hello,

In a DataGridView, I programmaticly select a row with:

dataGridView1.Rows[2].Selected = true;

That row is selected and blue, but...
In the RowHeader, the little black arrow is still on the first row until I
click on the row with the mouse.

The question, how can I set the little black arrow on the selected row,
without a mouseclick.

Thank you for you help.
GS
Oct 25 '06 #1
4 74374

You also have to set the FirstDisplayedScrollingRowIndex.
Like this:
dataGridView1.FirstDisplayedScrollingRowIndex = 2

Rich

GS wrote:
Hello,

In a DataGridView, I programmaticly select a row with:

dataGridView1.Rows[2].Selected = true;

That row is selected and blue, but...
In the RowHeader, the little black arrow is still on the first row until I
click on the row with the mouse.

The question, how can I set the little black arrow on the selected row,
without a mouseclick.

Thank you for you help.
GS
Oct 25 '06 #2
GS
Thanks for your answer, but it is nog working. The little black arrow is
still in the first row of the datagridview.

"koredump" <ko******@interia.plschreef in bericht
news:11**********************@m73g2000cwd.googlegr oups.com...
>
You also have to set the FirstDisplayedScrollingRowIndex.
Like this:
dataGridView1.FirstDisplayedScrollingRowIndex = 2

Rich

GS wrote:
>Hello,

In a DataGridView, I programmaticly select a row with:

dataGridView1.Rows[2].Selected = true;

That row is selected and blue, but...
In the RowHeader, the little black arrow is still on the first row until
I
click on the row with the mouse.

The question, how can I set the little black arrow on the selected row,
without a mouseclick.

Thank you for you help.
GS

Oct 25 '06 #3
the second row is selected but is not the CurrentRow.

try this:

DataGridView1.CurrentCell = DataGridView1[0, 2]

this code set the second row as the currentRow...
Oct 25 '06 #4
GS
Ok, this do the job. Thank you!!

"Franz" <Fr***@discussions.microsoft.comschreef in bericht
news:18**********************************@microsof t.com...
the second row is selected but is not the CurrentRow.

try this:

DataGridView1.CurrentCell = DataGridView1[0, 2]

this code set the second row as the currentRow...

Oct 25 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Dave A | last post by:
Hi, I am struggling with two way databinding in WinForms and the DataGridView. I am binding to business object classes (rather than datatables). If I have a collection of these business...
1
by: Rich | last post by:
Hello, I am reading data from a sql server table that is under replication. This table has the replicatin GUID column that is generated with replicatin. I am reading the data from a...
2
by: Rich | last post by:
Hello, Following an example at http://www.vb-tips.com/dbpages.aspx?IA=DG (by Cor Lightert and Ken Tucker) on binding a dataRelation to a Datagridview for sqlClient, I was able to view rows...
0
by: stevenhaochen | last post by:
I add a user control (a simple textbox control) to customize datagridview column to test how to add user control to datagridview. I found a weired behavior. I can not input "q", "!", "#". But I...
2
by: Steve Richter | last post by:
what is the best way to use DataGridView to view data from large database tables? Where the sql select statement might return millions of rows? string connectionString =...
4
by: =?Utf-8?B?UmljaA==?= | last post by:
On a form - I have a datagridview which is docked to the entire form. The datagridview allows users to Delete and/or Add Rows. On the Form_Load event I Fill the datagridview source table with a...
6
by: =?Utf-8?B?TWFyY2Vsbw==?= | last post by:
Hello, I am new to pulling data into VB and using DataGridViews..... so this might be a dumb question but I can not seem to understand how to make this work. What I need acomplished: Exec a...
6
by: JoaquimC | last post by:
Helo, I got this problem with a c# DataGridView in VS2005: The DataGridView has 2 columns: colArtigoGenerico, colArtigoFinal; and this columns are populated with data from 2 columns from a...
9
by: Miro | last post by:
My current headache is proper is with the datagridview I am starting to realize that a DataGridView within vs2008 is not as 'robust' as a 'textboxfield' by default for example. Example: A...
0
by: tkjensen | last post by:
Hi everyone. I hope someone can help me sort this out. My problem is that I need to update my DataGridView on Form2.closing. I need both the Form1 code and Form2 code. So I hope someone want's...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.