Solved

Help with selecting rows from grid control

Posted on 2013-01-07
2
228 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
ID: 38753732
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
ID: 38753828
Thanks!
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …

863 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

23 Experts available now in Live!

Get 1:1 Help Now