DataGridView get current selected object
Here is my code put this into your Person class
public static explicit operator Person(DataRow dr)
{
Person p = new Person();
p.adi = dr.ItemArray[0].ToString();
p.id = Int32.Parse(dr.ItemArray[1].ToString());
p.soyadi = dr.ItemArray[2].ToString();
p.kartNo = dr.ItemArray[3].ToString();
p.dogumTarihi = DateTime.Parse( dr.ItemArray[4].ToString() );
p.adres = dr.ItemArray[5].ToString();
p.meslek = dr.ItemArray[6].ToString();
p.telefon = dr.ItemArray[7].ToString();
p.gsm = dr.ItemArray[8].ToString();
p.eposta = dr.ItemArray[9].ToString();
return p;
}
and this is a update button click
DataRow row = (dataGridView1.SelectedRows[0].DataBoundItem as DataRowView).Row;
Person selected = (Person)row;
DataGridViewRow.DataBoundItem
contains the 'business' object it is bound to.