用dbgrid可以
如果您要用grid,也可以自己处理用户输入,
用一个textbox来接受输入,textbox的大小设置为grid网格大小,位置随(在grid中的)焦点而改变。
我想CSDN中会有这种例子的,您搜索一下吧。

解决方案 »

  1.   

    使msflexgrid能输入的例子,没有控制太好,自己修改一下吧
    Const ASC_ENTER = 13 '回车
    Dim gRow As Integer
    Dim gCol As IntegerPrivate Sub Command1_Click()
    Text1.Visible = Not Text1.Visible
    Text1.Text = Text1.Visible
    End SubPrivate Sub Grid1_KeyPress(KeyAscii As Integer)gRow = Grid1.Row
    gCol = Grid1.Col
    Text1.Text = Grid1.Text
    Text1.Move Grid1.Left + Grid1.CellLeft, Grid1.Top + Grid1.CellTop, Grid1.CellWidth, Grid1.CellHeight
    Text1.Visible = True
    Text1.ZOrder 0
    Text1.SetFocusIf KeyAscii <> ASC_ENTER Then
    SendKeys Chr$(KeyAscii)
    End If
    End SubPrivate Sub Text1_KeyPress(KeyAscii As Integer)
    If KeyAscii = ASC_ENTER Then
    Grid1.SetFocus
    KeyAscii = 0
    End If
    End SubPrivate Sub Text1_LostFocus()
    Dim tmpRow As Integer
    Dim tmpCol As Integer
    tmpRow = Grid1.Row
    tmpCol = Grid1.ColGrid1.Row = gRow
    Grid1.Col = gCol
    Grid1.Text = Text1.Text
    Text1.SelStart = 0
    Text1.Visible = FalseGrid1.Row = tmpRow
    Grid1.Col = tmpColEnd Sub
      

  2.   

    很简单:
    Private Sub GRID_KeyPress(KeyAscii As Integer)
      KEYASCII=0
    END SUB