你可以帮我吗?
因为当我按下输入单元格(0)时我停留在这段代码中这个事件转到另一个表格来获取数据和我输入到datagridview的数据,这是第一种形式,其中有一个单元格之间的总和,其中值单元格(6)是第二个单元格和第三个单元格的总和,然后我想将焦点移动到单元格到单元格(2),如果单元格(5)它的值是0,它将集中于那个我点击进入单元格(2)时的单元格
Private Sub tb_KeyDown(sender As Object, e As KeyEventArgs) Handles tb.KeyDown
If tb.CurrentCell.ColumnIndex = 0 Then
Select Case e.KeyCode
Case Keys.Enter
e.SuppressKeyPress = True
Dim frm As New f_pilihbarangreturbeli
Dim hitung As Double
With frm
.ShowDialog()
.tampil()
Dim duplikasi As Boolean = False
If Not .a = "" Then
For Each i As DataGridViewRow In tb.Rows
If Not i.IsNewRow Then
If i.Cells(0).Value.ToString = .a Then
duplikasi = True
i.Cells(3).Value += 1
hitung = Val(i.Cells(3).Value.ToString) * Val(i.Cells(2).Value.ToString)
i.Cells(6).Value = hitung
End If
End If
Next
If Not duplikasi Then
dt.Rows.Add(.a, .b, .c, "1", .f, "0", hitung)
Dim blank As Boolean = True
For Each i As DataGridViewRow In tb.Rows
If Not i.IsNewRow Then
i.Cells(6).Value = Val(i.Cells(3).Value.ToString) * Val(i.Cells(2).Value.ToString)
End If
Next
For Each _row As DataGridViewRow In tb.Rows
blank = True
For a As Integer = 0 To _row.Cells.Count - 1
If _row.Cells(a).Value.ToString IsNot Nothing AndAlso _row.Cells(a).Value.ToString <> "" Then
blank = False
Exit For
End If
Next
If blank Then
If Not _row.IsNewRow Then
tb.Rows.Remove(_row)
End If
End If
Next
End If
End If
End With
End Select
End If
End Sub
抱歉英语不好因为我还在学习舞台