ashkan1234
چهارشنبه 04 بهمن 1391, 22:29 عصر
با سلام!من از کد زیر برای بازگشت اطلاعات در تکست باکسها اسفاده میکنم!
ولی وقتی رو هرکدوم از هدرهای گریدویو کلیک میکنم با خظا مواجه میشم!
private void dataGridView1_SelectionChanged(object sender, EventArgs e)
{
try
{
txtname.Text = dataGridView1.CurrentRow.Cells[1].Value.ToString();
txtfamily.Text = dataGridView1.CurrentRow.Cells[2].Value.ToString();
txttel.Text = dataGridView1.CurrentRow.Cells[3].Value.ToString();
}
catch (Exception)
{
throw;
}
}
به throw گیرمیده!میگه شئ نمونه گیری نشده!
Object reference not set to an instance of an object.
ممنون میشم راهنمایی بفرمایید!
ولی وقتی رو هرکدوم از هدرهای گریدویو کلیک میکنم با خظا مواجه میشم!
private void dataGridView1_SelectionChanged(object sender, EventArgs e)
{
try
{
txtname.Text = dataGridView1.CurrentRow.Cells[1].Value.ToString();
txtfamily.Text = dataGridView1.CurrentRow.Cells[2].Value.ToString();
txttel.Text = dataGridView1.CurrentRow.Cells[3].Value.ToString();
}
catch (Exception)
{
throw;
}
}
به throw گیرمیده!میگه شئ نمونه گیری نشده!
Object reference not set to an instance of an object.
ممنون میشم راهنمایی بفرمایید!