DataGridViewCellValidatingEventArgs.RowIndex プロパティ
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)

検証する必要のあるセルの行インデックスを指定する、0 から始まる整数。

このプロパティの使用方法を示すコード例を次に示します。次の例は「方法 : Windows フォーム DataGridView コントロールのデータを検証する」で取り上げている例の一部です。
Private Sub dataGridView1_CellValidating(ByVal sender As Object, _ ByVal e As DataGridViewCellValidatingEventArgs) _ Handles dataGridView1.CellValidating ' Validate the CompanyName entry by disallowing empty strings. If dataGridView1.Columns(e.ColumnIndex).Name = "CompanyName" Then If String.IsNullOrEmpty(e.FormattedValue.ToString()) Then dataGridView1.Rows(e.RowIndex).ErrorText = _ "Company Name must not be empty" e.Cancel = True End If 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
private void dataGridView1_CellValidating(object sender, DataGridViewCellValidatingEventArgs e) { // Validate the CompanyName entry by disallowing empty strings. if (dataGridView1.Columns[e.ColumnIndex].Name == "CompanyName") { if (String.IsNullOrEmpty(e.FormattedValue.ToString())) { dataGridView1.Rows[e.RowIndex].ErrorText = "Company Name must not be empty"; e.Cancel = true; } } } void dataGridView1_CellEndEdit(object sender, DataGridViewCellEventArgs e) { // Clear the row error in case the user presses ESC. dataGridView1.Rows[e.RowIndex].ErrorText = String.Empty; }
private: void dataGridView1_CellValidating(Object^ /*sender*/, DataGridViewCellValidatingEventArgs^ e) { // Validate the CompanyName entry by disallowing empty strings. if (dataGridView1->Columns[e->ColumnIndex]->Name == "CompanyName") { if (e->FormattedValue->ToString() == String::Empty) { dataGridView1->Rows[e->RowIndex]->ErrorText = "Company Name must not be empty"; e->Cancel = true; } } } private: void dataGridView1_CellEndEdit(Object^ /*sender*/, DataGridViewCellEventArgs^ e) { // Clear the row error in case the user presses ESC. dataGridView1->Rows[e->RowIndex]->ErrorText = String::Empty; }

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Weblioに収録されているすべての辞書からDataGridViewCellValidatingEventArgs.RowIndex プロパティを検索する場合は、下記のリンクをクリックしてください。

- DataGridViewCellValidatingEventArgs.RowIndex プロパティのページへのリンク