Show checked rows into another DataGridView

前端 未结 3 1409
悲哀的现实
悲哀的现实 2020-12-02 02:42

I have a DataGridView populated with a DataTable.
I added a CheckBoxColumn to select some rows.

My Goal is to show only se

3条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-02 03:28

    I propose that you add column "Sel" as Boolean in your datatable "DT_Events" . Change your first code to :

     DT_Events.Columns.Add("Sel", GetType(Boolean))
      DT_Events.Columns("Sel").SetOrdinal(0)
    With Me.DataGridView1
        .Columns.Clear()
        .DataSource = DT_Events
        .Columns("Event").AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells
    End With
    

    And the seconde code will work with copying the selected row into "DataGridView2"

提交回复
热议问题