且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在表格的表格中显示某些列?

更新时间:2023-01-29 14:16:58

看看这个: ^ ]

您可以根据需要定义和映射列.

如果您需要更多的知识和学习,则只用Google.
Have a look at this: How to set up DataGrid Columns programatically[^]

You can define and map the columns as per your need.

Just Google for it, if you need more to know and learn.


您可以尝试一下...
You can play around with this...
Private Sub FormatDataGridX(dgv as DataGridView)

  For i As Integer = 0 To dgv.Columns.Count - 1
    
    Select Case dgv.Columns(i).HeaderText
      
      Case "Id"
        dgv.Columns(i).Visible = False
      Case "Comments"
        dgv.Columns(i).Visible = False
      Case "...."
        ....

    End Select

  Next ' i

End Sub