datagridview设置成不能自动添加行,如何用键盘上的Tab键实现添加行的功能???
datagridview设置成不能自动添加行,如何用键盘上的Tab键实现添加行的功能???
Public Class Form1 '窗体上随便画一个datagridview控件 Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load DataGridView1.ColumnCount = 3 DataGridView1.Rows.Add() DataGridView1.AllowUserToAddRows = False '设置成不能自动添加行 End Sub Private Sub DataGridView1_KeyUp(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles DataGridView1.KeyUp If DataGridView1.CurrentRow.Index = DataGridView1.Rows.Count - 1 And DataGridView1.CurrentCell.ColumnIndex = DataGridView1.ColumnCount - 1 Then DataGridView1.Rows.Add() End If End Sub End Class