C# WinForm编程之System.Windows.Forms.DataGridViewRow.DataBoundItem Property
生活随笔
收集整理的這篇文章主要介紹了
C# WinForm编程之System.Windows.Forms.DataGridViewRow.DataBoundItem Property
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
Namespace:
System.Windows.Forms
Assembly:
System.Windows.Forms.dll
獲取用于填充行的數據綁定對象。
下面的代碼示例演示如何使用 DataBoundItem 屬性訪問綁定到行的業務對象。 此代碼示例是如何:訪問綁定到 Windows 窗體 DataGridView 行的對象中提供的一個更大示例的一部分。
void invoiceButton_Click(object sender, EventArgs e) {foreach (DataGridViewRow row in this.dataGridView1.SelectedRows){Customer cust = row.DataBoundItem as Customer;if (cust != null){cust.SendInvoice();}} }Remarks
當你不能直接訪問包含對象的數據源時,通過行對象直接訪問數據綁定對象非常有用。 當您希望操作綁定到選定行或作為參數傳遞給事件處理程序的行時,這也是非常方便的。
總結
以上是生活随笔為你收集整理的C# WinForm编程之System.Windows.Forms.DataGridViewRow.DataBoundItem Property的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Python中使用you-get库批量在
- 下一篇: CMD命令查看当前电脑安装.NET Co