要实现你的功能,我大多数就不用 DataGrid 了!
好像,DataGrid 不能控制每个行,或者列!
所以,这时候我觉得还是用 一堆 Text 搞定!

解决方案 »

  1.   

    DataGrid1.Columns.Item(i).Locked =True 'False
      

  2.   

    多谢,我知道MSHFlexGrid控件可实现,但它不能实时更新,一定要用DataGrid,请各位大侠多指点
      

  3.   

    Private Sub DGZCJ_KeyPress(KeyAscii As Integer)
    On Error Resume Next
    If dgZCJ.Col <> 2 Then Exit Sub
    If tpKCXX.bTJ Then Exit SubIf Not (KeyAscii = 13 Or KeyAscii = 8 Or KeyAscii = 46 Or KeyAscii > 47 And KeyAscii < 58) Then
        KeyAscii = 0
        MsgBox "输入非法,请您输入数字", vbExclamation + vbOKOnly, "非法"
        Exit Sub
    End If
        If KeyAscii = 13 Then
        
        If dgZCJ.Text < 0 Or dgZCJ.Text > 100 Then
            MsgBox "请输入0-100之间的成绩"
        Else
            dgZCJ.Row = dgZCJ.Row + 1
        End If
    End If
    End Sub
    Private Sub DGzcj_RowColChange(LastRow As Variant, ByVal LastCol As Integer)
    If .. Then Exit Sub
    If dgZCJ.Col <> 2 Then
    dgZCJ.AllowUpdate = False
    Else
    dgZCJ.AllowUpdate = True
    End If
    End Sub