UZIERSKI UZIERSKI - 5 months ago 24 Question

How to convert this to C# properly?

How Do I convert this line of code to c# properly as the

cannot be used like a method.

Dim RecordValue As Int32 = grdList.SelectedRows(0).DataBoundItem.Item(_ValueMember)


The DataBoundItem is typed as Object, you cannot apply an indexing to this property. Instead if you have binded a DataTable/DataView then you can cast the DataBoundItem to the appropriate object and then, if that class offers indexing you can use indexing

DataRowView rowView = grdList.SelectedRows[0].DataBoundItem as DataRowView;
int recordValue = Convert.ToInt32(rowView[_ValueMember]);