本文整理匯總了VB.NET中System.Windows.Forms.DataGridView.RowsRemoved事件的典型用法代碼示例。如果您正苦於以下問題:VB.NET DataGridView.RowsRemoved事件的具體用法?VB.NET DataGridView.RowsRemoved怎麽用?VB.NET DataGridView.RowsRemoved使用的例子?那麽, 這裏精選的事件代碼示例或許可以為您提供幫助。您也可以進一步了解該事件所在類System.Windows.Forms.DataGridView
的用法示例。
在下文中一共展示了DataGridView.RowsRemoved事件的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的VB.NET代碼示例。
示例1: CellValueChanged
Private Sub CellValueChanged(ByVal sender As Object, _
ByVal e As DataGridViewCellEventArgs) _
Handles DataGridView1.CellValueChanged
' Update the balance column whenever the values of any cell changes.
UpdateBalance()
End Sub
Private Sub RowsRemoved(ByVal sender As Object, _
ByVal e As DataGridViewRowsRemovedEventArgs) _
Handles DataGridView1.RowsRemoved
' Update the balance column whenever rows are deleted.
UpdateBalance()
End Sub
Private Sub UpdateBalance()
Dim counter As Integer
Dim balance As Integer
Dim deposit As Integer
Dim withdrawal As Integer
' Iterate through the rows, skipping the Starting Balance Row.
For counter = 1 To (DataGridView1.Rows.Count - 2)
deposit = 0
withdrawal = 0
balance = Integer.Parse(DataGridView1.Rows(counter - 1) _
.Cells("Balance").Value.ToString())
If Not DataGridView1.Rows(counter) _
.Cells("Deposits").Value Is Nothing Then
' Verify that the cell value is not an empty string.
If Not DataGridView1.Rows(counter) _
.Cells("Deposits").Value.ToString().Length = 0 Then
deposit = Integer.Parse(DataGridView1.Rows(counter) _
.Cells("Deposits").Value.ToString())
End If
End If
If Not DataGridView1.Rows(counter) _
.Cells("Withdrawals").Value Is Nothing Then
If Not DataGridView1.Rows(counter) _
.Cells("Withdrawals").Value.ToString().Length = 0 Then
withdrawal = Integer.Parse(DataGridView1.Rows(counter) _
.Cells("Withdrawals").Value.ToString())
End If
End If
DataGridView1.Rows(counter).Cells("Balance").Value = _
(balance + deposit + withdrawal).ToString()
Next
End Sub