Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Check box getting unchecked while sorting column in datagridview

Check box getting unchecked while sorting column in datagridview

Scheduled Pinned Locked Moved Visual Basic
algorithmshelpquestion
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    hisuman100
    wrote on last edited by
    #1

    Check box column getting unchecked when I am sorting column in datagridview. Can any one can help me? Regds. Suman

    C 1 Reply Last reply
    0
    • H hisuman100

      Check box column getting unchecked when I am sorting column in datagridview. Can any one can help me? Regds. Suman

      C Offline
      C Offline
      C1AllenS
      wrote on last edited by
      #2

      Hello Suman, I have checked this and it works fine for me. Could you please provide us a small sample application showing the mentioned behavior. Regards, Allen

      Allen Smith ComponentOne LLC www.componentone.com

      H 1 Reply Last reply
      0
      • C C1AllenS

        Hello Suman, I have checked this and it works fine for me. Could you please provide us a small sample application showing the mentioned behavior. Regards, Allen

        Allen Smith ComponentOne LLC www.componentone.com

        H Offline
        H Offline
        hisuman100
        wrote on last edited by
        #3

        Imports System Imports System.Data.SqlClient Public Class Form1 Dim str As String Dim con As SqlConnection Dim da As SqlDataAdapter Dim ds As New DataSet Dim dt As DataTable Dim dv As DataView Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load str = "Integrated Security=SSPI; User Id=sa;Initial Catalog=MAS08; Data Source = suman" con = New SqlConnection(str) con.Open() str = "select * from unitmaster" da = New SqlDataAdapter(str, con) da.Fill(ds, "unitmaster") dt = ds.Tables(0) dv = New DataView(dt) Dim colCheckbox As New DataGridViewCheckBoxColumn() ' Size the column width so it is wide enough to display the header colCheckbox.AutoSizeMode = DataGridViewAutoSizeColumnMode.ColumnHeader colCheckbox.ThreeState = False colCheckbox.TrueValue = 1 colCheckbox.FalseValue = 0 colCheckbox.IndeterminateValue = System.DBNull.Value colCheckbox.DataPropertyName = "Checkbox" colCheckbox.HeaderText = "Checkbox" colCheckbox.Name = "Checkbox" 'colCheckbox.ReadOnly = True dgv.Columns.Add(colCheckbox) dgv.DataSource = dv End Sub End Class

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups