Solved

Help with selecting rows from grid control

Posted on 2013-01-07
2
226 Views
Last Modified: 2013-01-08
Hello,

I am using the code below to select rows where keySDeactivation = "1,2", which exist in column(0), the code goes through all the steps as indicated in the Msgboxes but for some reason the rows are not selected, any ideas what is wrong with the code?


 Private Sub ViewDataC(ByVal keyLinkAid As String, ByVal keySDeactivation As String)
        ' MsgBox("TestA" & keySDeactivation) - ok
        If keySDeactivation <> "" Then
            Dim _tableA As DataView = dtMasterA.DefaultView
            '   _table.RowFilter = "SDeactivation_ID in (" & keySDeactivation & ")"
            C1SDeactivation.DataSource = _tableA
            MsgBox("COUNTSDEACTIVATION" & C1SDeactivation.RowCount)
            '     keySDeactivation = "1,2,3"
            For i As Integer = 0 To C1SDeactivation.RowCount - 1
                MsgBox("Testb" & keySDeactivation) --ok
                 If C1SDeactivation.Columns(0).CellValue(i).ToString().Contains(keySDeactivation) = True Then

                    C1SDeactivation.SelectedRows.Add(i) ' does not work
                    MsgBox("testc") ---ok
                End If
            Next
        End If
0
Comment
Question by:vcharles
2 Comments
 
LVL 39

Accepted Solution

by:
Pratima Pharande earned 500 total points
Comment Utility
I think you need to go for the syntax link thsi

dataGrid.Rows[index].Selected = true;

chekc this

http://stackoverflow.com/questions/6265228/selecting-a-row-in-datagridview-programatically
0
 

Author Closing Comment

by:vcharles
Comment Utility
Thanks!
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
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.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

763 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now