本文整理匯總了VB.NET中System.Windows.Forms.DataGridViewCellValidatingEventArgs.ColumnIndex屬性的典型用法代碼示例。如果您正苦於以下問題:VB.NET DataGridViewCellValidatingEventArgs.ColumnIndex屬性的具體用法?VB.NET DataGridViewCellValidatingEventArgs.ColumnIndex怎麽用?VB.NET DataGridViewCellValidatingEventArgs.ColumnIndex使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類System.Windows.Forms.DataGridViewCellValidatingEventArgs
的用法示例。
在下文中一共展示了DataGridViewCellValidatingEventArgs.ColumnIndex屬性的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的VB.NET代碼示例。
示例1: If
Private Sub dataGridView1_CellValidating(ByVal sender As Object, _
ByVal e As DataGridViewCellValidatingEventArgs) _
Handles dataGridView1.CellValidating
Dim headerText As String = _
dataGridView1.Columns(e.ColumnIndex).HeaderText
' Abort validation if cell is not in the CompanyName column.
If Not headerText.Equals("CompanyName") Then Return
' Confirm that the cell is not empty.
If (String.IsNullOrEmpty(e.FormattedValue.ToString())) Then
dataGridView1.Rows(e.RowIndex).ErrorText = _
"Company Name must not be empty"
e.Cancel = True
End If
End Sub
Private Sub dataGridView1_CellEndEdit(ByVal sender As Object, _
ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) _
Handles dataGridView1.CellEndEdit
' Clear the row error in case the user presses ESC.
dataGridView1.Rows(e.RowIndex).ErrorText = String.Empty
End Sub
開發者ID:VB.NET開發者,項目名稱:System.Windows.Forms,代碼行數:26,代碼來源:DataGridViewCellValidatingEventArgs.ColumnIndex