Monielle,
Sim, é possível usar a propriedade DataBoundItem. Veja o código abaixo.
public
partial class
SeuForm : Form
{
private
BindingSource _bindingSource = new
BindingSource();
public SeuForm()
{
InitializeComponent();
}
private
void SeuForm_Load(object sender,
EventArgs e)
{
// uma lista qualquer
var bindingList = new
BindingList<DemoCustomer>();
bindingList.Add(new
DemoCustomer { CustomerName =
"Ari" });
bindingList.Add(new
DemoCustomer { CustomerName =
"Michael" });
bindingList.Add(new
DemoCustomer { CustomerName =
"LeBron" });
// binding
this._bindingSource.DataSource = bindingList;
this.seuDataGridView.DataSource = this._bindingSource;
}
private
void btnMostrarCelulaCorrente_Click(object sender,
EventArgs e)
{
// aqui mostramos o valor da célula corrente
if (this.seuDataGridView.CurrentRow !=
null)
{
var demoCustomer = this.seuDataGridView.CurrentRow.DataBoundItem
as DemoCustomer;
MessageBox.Show(demoCustomer.CustomerName);
}
}
}
Obs: DemoCustomer seria uma classe qualquer de negócio.
Segue alguns links de ajuda.
DataGridViewRow.DataBoundItem Property
http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridviewrow.databounditem.aspx
How to: Access Objects Bound to Windows Forms DataGridView Rows
http://msdn.microsoft.com/en-us/library/4wszzzc7.aspx
How to: Bind Objects to Windows Forms DataGridView Controls
http://msdn.microsoft.com/en-us/library/y0wfd4yz.aspx
Espero ter ajudado.
Ari C. Raimundo
MCAD, MCTS
http://araimundo.blogspot.com