datagridview
의 두 열을 곱하고 동일한 열 3의 제품을 표시하려면 datagridview
.DataGridView Vb에서 셀 자동 계산
예
Column1 - Column2 - Column3
12 2 24
15 2 30
은 여기 내 코드
Private Sub Table1DataGridView1_CellContentClick(sender As Object, e As DataGridViewCellEventArgs) Handles Table1DataGridView1.CellValidated
Try
Dim iCell1 As Integer
Dim icell2 As Integer
Dim icellResult As Integer
iCell1 = Table1DataGridView1.CurrentRow.Cells(1).Value
icell2 = Table1DataGridView1.CurrentRow.Cells(2).Value
If String.IsNullOrEmpty(iCell1) OrElse String.IsNullOrEmpty(icell2) Then Exit Sub
If Not IsNumeric(iCell1) OrElse Not IsNumeric(icell2) Then Exit Sub
icellResult = CDbl(iCell1) * CDbl(icell2)
Table1DataGridView1.CurrentRow.Cells(3).Value = icellResult
Catch ex As Exception
MessageBox.Show(ex.ToString)
End Try
End Sub
그것은 작동하지만 새 행 나중에 추가된다. 그러니 도와주세요.
우리는 내가 MultiplyPair 전화, 새로운 클래스를 만들 :