用DATAGRID控件时,显示数据并且在DATAGRID中直接添加数据,如何设置回车跳到下一行。

解决方案 »

  1.   

    假设DATAGRID1控件的数据源是ADODC1控件,即:
    Private Sub DataGrid1_KeyPress(KeyAscii As Integer)
        If KeyAscii = 13 Then
            If Adodc1.Recordset.EOF = False Then
                DataGrid1.Row = DataGrid1.Row + 1
            End If
        End If
    End Sub
      

  2.   

    Private Sub DataGrid1_KeyPress(KeyAscii As Integer)
      If KeyAscii = 13 Then
         Rs.AddNew
      End If
    End Sub