vb.net中如何限—ataGridview的某列只能输入数字
我在datagridview中需要限制某列只能输入输入数字,不能输入其它的,同时如果数字是3.3.3这样的也是不合理的。请问这样的代码要怎么写呢 DataGridView VB.NET 输入限制
[解决办法]
http://www.developerfusion.com/tools/convert/csharp-to-vb/
[解决办法]
Private Sub DataGridView1_CellValidating(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellValidatingEventArgs) Handles DataGridView1.CellValidating
If DataGridView1.Rows(e.RowIndex).IsNewRow Then Exit Sub
If e.ColumnIndex = 4 Then
If IsNumeric(DataGridView1.Rows(e.RowIndex).Cells(e.ColumnIndex).Value) = False Then
e.Cancel = True
MsgBox("请输入数字或小数")
End If
End If
End Sub