DataGridViewRowEventArgs.Row 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
取得與事件關聯的 DataGridViewRow。
public:
property System::Windows::Forms::DataGridViewRow ^ Row { System::Windows::Forms::DataGridViewRow ^ get(); };
public System.Windows.Forms.DataGridViewRow Row { get; }
member this.Row : System.Windows.Forms.DataGridViewRow
Public ReadOnly Property Row As DataGridViewRow
屬性值
與事件關聯的 DataGridViewRow。
範例
下列程式碼範例說明如何使用此類型。
private void dataGridView1_DefaultValuesNeeded(object sender,
System.Windows.Forms.DataGridViewRowEventArgs e)
{
e.Row.Cells["Region"].Value = "WA";
e.Row.Cells["City"].Value = "Redmond";
e.Row.Cells["PostalCode"].Value = "98052-6399";
e.Row.Cells["Country"].Value = "USA";
e.Row.Cells["CustomerID"].Value = NewCustomerId();
}
Private Sub dataGridView1_DefaultValuesNeeded(ByVal sender As Object, _
ByVal e As System.Windows.Forms.DataGridViewRowEventArgs) _
Handles dataGridView1.DefaultValuesNeeded
With e.Row
.Cells("Region").Value = "WA"
.Cells("City").Value = "Redmond"
.Cells("PostalCode").Value = "98052-6399"
.Cells("Country").Value = "USA"
.Cells("CustomerID").Value = NewCustomerId()
End With
End Sub