关于VB.NET Datagridview光标定位问题!急!求帮忙
我对DataGridView的cell进行了输入合法的检查, 只能输入数字,输入非法弹出对话框,点击确定后想让当前的cell 获取焦点。 代码如下:
For i As Integer = 1 To Len(tempStr)
Dim ch1 As String = Mid(tempStr, i, 1) '取得输入的字符串
If ch1 >= "0" AndAlso ch1 <= "9" Then
tempBool = False
ElseIf ch1 = "-" Then
tempBool1 = False
Else
tempMsg = "Only numbers or ' - ' allow input!"
Dim m_Sysmsg As New SysMsg
m_Sysmsg.ShowDialog()
Me.DataGrid_Score.Rows(e.RowIndex).Cells(e.ColumnIndex).Value = String.Empty
Me.DataGrid_Score.ClearSelection()
Me.DataGrid_Score.Rows(e.RowIndex).Cells(e.ColumnIndex).Selected = True
Me.DataGrid_Score.currentcells = Me.DataGrid_Score.Rows(e.RowIndex).Cells(e.ColumnIndex)
Return
End If
Next