Solved

Help with selecting rows from grid control

Posted on 2013-01-07
2
233 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
[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
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

Resolve Critical IT Incidents Fast

If your data, services or processes become compromised, your organization can suffer damage in just minutes and how fast you communicate during a major IT incident is everything. Learn how to immediately identify incidents & best practices to resolve them quickly and effectively.

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)…
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…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

752 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