?
Solved

Help with selecting first row in DataGridView

Posted on 2014-03-10
6
Medium Priority
?
430 Views
Last Modified: 2014-03-11
Hi,

After I load the GridView with a Data Table, How do I automatically select the first row, required to activate data in another Grid.

If FilteredDTA.Rows.Count > 0 Then
                Me.C1A.DataSource = FilteredDTA
               C1A.Rows(0).Selected = True '*** Does not work
End If

Thanks,

Victor
0
Comment
Question by:vcharles
  • 4
  • 2
6 Comments
 
LVL 64

Accepted Solution

by:
Fernando Soto earned 2000 total points
ID: 39919655
Hi Victor;

This command, C1A.Rows(0).Selected = True, should be selecting the first row of the DataGridView C1A. What will not be happening is the automatic selection of the matching rows in the other DataGridView because that is being selected through code. If you want them to be selected you need to call the code that selects them.
0
 

Author Comment

by:vcharles
ID: 39920032
Hi,

I thought so too, but the first row is not highlighted, shouldn't it be highlighted when selected?

Thanks,

Victor
0
 

Author Comment

by:vcharles
ID: 39920272
Hi,

My mistake, I used the wrong code. Since the code to load the first Grid is in the Form load event, to activate the code to view the data in the other other grid, I will also include the code in the Formload event.

Thanks,

Victor
0
Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

 

Author Closing Comment

by:vcharles
ID: 39920348
Thank You.
0
 
LVL 64

Expert Comment

by:Fernando Soto
ID: 39920413
You may want to place that code in a Sub so that when you need it you can make a single call to it.
0
 

Author Comment

by:vcharles
ID: 39920493
That is a good idea, will do.

Thanks.

Victor
0

Featured Post

Transaction-level recovery for Oracle database

Veeam Explore for Oracle delivers low RTOs and RPOs with agentless transaction log backup and transaction-level recovery of Oracle databases. You can restore the database to a precise point in time, even to a specific transaction.

Question has a verified solution.

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

Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Simulator games are perfect for generating sample realistic data streams, especially for learning data analysis. It is even useful for demoing offerings such as Azure stream analytics, PowerBI etc.
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
Suggested Courses
Course of the Month16 days, 7 hours left to enroll

850 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