473,372 Members | 903 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,372 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 74368

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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...

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.