Link to home
Start Free TrialLog in
Avatar of Victor  Charles
Victor CharlesFlag for United States of America

asked on

Help with selecting all rows in a DataGrid

Hi,

My DataGrid contains two columns a checkbox column from code below and a country column. How do I select all the rows including checkboxes from a button click event using VB.NET?

Private Sub CheckControl()
        Dim CheckBoxCol As New DataGridViewCheckBoxColumn
        With CheckBoxCol
            .Name = "CheckBoxColumn"
            .HeaderText = "Select"
            .Width = 40
        End With
        Me.C1TrueDBGrid3.Columns.Insert(0, CheckBoxCol)
    End Sub

Thanks,

Victor
Avatar of Fernando Soto
Fernando Soto
Flag of United States of America image

Hi Victor;

When you say, "How do I select all the rows including checkboxes from a button click event using VB.NET?", do you mean that all the row become a member of the Selected collection of the DataGridView or that all the check boxes have a check placed in them?
Avatar of Victor  Charles

ASKER

Hi,

I would like all the check boxes to  have a check placed in them and change their back color to blue.

Thanks.
ASKER CERTIFIED SOLUTION
Avatar of Fernando Soto
Fernando Soto
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thank You, will try it and get back to you.
Thank You.
Not a problem Victor, glad to help.