473,289 Members | 1,961 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,289 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 74353

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...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...

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.