# How to add new row?

Posted by zsz on August 20, 1999 at 16:08:37:

在MSHFLEXGRID控件中，如果当前行是最后一行，再按VBkeydown时，
新增一行，如下：
Private Sub Grid1_KeyDown(KeyCode As Integer, Shift As Integer)
Select Case KeyCode
Case vbKeyDown
If Grid1.Row = Grid1.Rows - 1 Then
MSHFLEXGRID1.ROWS=MSHFLEXGRID1.ROWS+1
MSHFLEXGRID1.ROW=MSHFLEXGRID1.ROW+1
End If
End Select
运行程序，若焦点处于最后一行，VBkeydown时能新增一行，可是，焦点
位于倒数第二行，VBkeydown时也能新一行，如何控制？

Follow Ups: