Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Help with selecting rows from grid control

Posted on 2013-01-07
2
Medium Priority
?
237 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 2000 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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
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.
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Screencast - Getting to Know the Pipeline
Suggested Courses

876 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