Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Help with selecting first row in DataGridView

Posted on 2014-03-10
6
Medium Priority
?
428 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 

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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

Welcome my friends to the second instalment and follow-up to our Minify and Concatenate Your Scripts and Stylesheets (http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/A_4334-Minify-and-Concatenate-Your-Scripts-and-Stylesheets.html)…
In my previous article (http://www.experts-exchange.com/Programming/Languages/.NET/.NET_Framework_3.x/A_4362-Serialization-in-NET-1.html) we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…

618 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