DataGridViewCellParsingEventArgs.RowIndex Vlastnost

Definice

Získá index řádku buňky, která vyžaduje parsování.

public:
 property int RowIndex { int get(); };
public int RowIndex { get; }
member this.RowIndex : int
Public ReadOnly Property RowIndex As Integer

Hodnota vlastnosti

Index řádku změněné buňky.

Příklady

Následující příklad kódu ukazuje použití tohoto členu. V příkladu obslužná rutina události hlásí výskyt DataGridView.CellParsing události. Tato sestava vám pomůže zjistit, kdy k události dojde, a může vám pomoct s laděním. Pokud chcete hlásit více událostí nebo událostí, ke kterým dochází často, zvažte nahrazení MessageBox.ShowConsole.WriteLine nebo připojení zprávy k víceřádkovému TextBoxobjektu .

Pokud chcete spustit ukázkový kód, vložte ho do projektu, který obsahuje instanci typu DataGridView s názvem DataGridView1. Pak se ujistěte, že je obslužná rutina události přidružená k DataGridView.CellParsing události.

private void DataGridView1_CellParsing(Object sender, DataGridViewCellParsingEventArgs e) {

System.Text.StringBuilder messageBoxCS = new System.Text.StringBuilder();
messageBoxCS.AppendFormat("{0} = {1}", "RowIndex", e.RowIndex );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "ColumnIndex", e.ColumnIndex );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "InheritedCellStyle", e.InheritedCellStyle );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "ParsingApplied", e.ParsingApplied );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "Value", e.Value );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "DesiredType", e.DesiredType );
messageBoxCS.AppendLine();
MessageBox.Show(messageBoxCS.ToString(), "CellParsing Event" );
}
Private Sub DataGridView1_CellParsing(sender as Object, e as DataGridViewCellParsingEventArgs) _ 
     Handles DataGridView1.CellParsing

    Dim messageBoxVB as New System.Text.StringBuilder()
    messageBoxVB.AppendFormat("{0} = {1}", "RowIndex", e.RowIndex)
    messageBoxVB.AppendLine()
    messageBoxVB.AppendFormat("{0} = {1}", "ColumnIndex", e.ColumnIndex)
    messageBoxVB.AppendLine()
    messageBoxVB.AppendFormat("{0} = {1}", "InheritedCellStyle", e.InheritedCellStyle)
    messageBoxVB.AppendLine()
    messageBoxVB.AppendFormat("{0} = {1}", "ParsingApplied", e.ParsingApplied)
    messageBoxVB.AppendLine()
    messageBoxVB.AppendFormat("{0} = {1}", "Value", e.Value)
    messageBoxVB.AppendLine()
    messageBoxVB.AppendFormat("{0} = {1}", "DesiredType", e.DesiredType)
    messageBoxVB.AppendLine()
    MessageBox.Show(messageBoxVB.ToString(),"CellParsing Event")

End Sub

Poznámky

RowIndex Pomocí vlastnosti získáte index do Rows vlastnosti objektu DataGridView.

Platí pro

Viz také