Gets the data-bound object that populated the row.

Namespace:   System.Windows.Forms
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)

public object DataBoundItem { get; }
property Object^ DataBoundItem {
	Object^ get();
member DataBoundItem : Object with get
Public ReadOnly Property DataBoundItem As Object

Property Value


The data-bound Object.


Accessing data-bound objects directly through row objects is useful when you do not have direct access to the data source containing the objects. It is also convenient when you want to manipulate objects bound to selected rows or to rows passed as arguments to event handlers.


The following code example demonstrates how to use the property to access a business object bound to a row. This code example is part of a larger example provided in How to: Access Objects Bound to Windows Forms DataGridView Rows.

void invoiceButton_Click(object sender, EventArgs e)
    foreach (DataGridViewRow row in this.dataGridView1.SelectedRows)
        Customer cust = row.DataBoundItem as Customer;
        if (cust != null)
Private Sub InvoiceButton_Click(ByVal sender As System.Object, _
    ByVal e As System.EventArgs) Handles InvoiceButton.Click

    For Each row As DataGridViewRow In Me.DataGridView1.SelectedRows

        Dim cust As Customer = TryCast(row.DataBoundItem, Customer)
        If cust IsNot Nothing Then
        End If


End Sub
Version Information
.NET Framework
Available since 2.0
Return to top