16,717
社区成员
发帖
与我相关
我的任务
分享
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'禁止编辑单元格
DataGridView1.ReadOnly = True
'禁止添加行
DataGridView1.AllowUserToAddRows = False
'禁止删除行
DataGridView1.AllowUserToDeleteRows = False
'禁止调整列的宽度
DataGridView1.AllowUserToResizeColumns = False
'禁止调整行的宽度
DataGridView1.AllowUserToResizeRows = False
'禁止点击表头排序
For i = 0 To DataGridView1.ColumnCount - 1
DataGridView1.Columns(i).SortMode = DataGridViewColumnSortMode.NotSortable
Next
End Sub
End Class