Hi all. Is it possible to apply a checkbox in column header? If yes, how can this be done? And also can different types of options be provided to the user like in Win Vista ?
Please reply soon I need it badly.
Thanks.

Recommended Answers

All 2 Replies

Dim c1 As New DataGridViewCheckBoxColumn()
        c1.HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
        Me.dgvFilter.Columns.Add(c1)
        Dim ckBox As New CheckBox()
        'Get the column header cell bounds
        Dim rect As Rectangle = Me.dgvFilter.GetCellDisplayRectangle(0, -1, True)
        'Change the location of the CheckBox to make it stay on the header
        ckBox.Location = dgvFilter.GetCellDisplayRectangle(0, -1, True).Location
        ckBox.BackColor = Color.Transparent
        'Add the CheckBox into the DataGridView
        Me.dgvFilter.Controls.Add(ckBox)

thanks, i needed this too.. :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.