مهدی هادیان2
پنج شنبه 06 بهمن 1390, 17:54 عصر
بسم الله الرحمن الرحیم
با سلام
من در فرم اول فرم دوم رو صدا کردم. در فرم دوم می خوام وقتی روی یه ستون از دیتا گرید کلیک می کنه و دکمه تائید رو می زنه سطر مربوطه به فرم اول برگردانده شود.
کد مربوطه رو در رویداد دکمه تائید به شکل زیر نوشتم
privateDataRow btnOk_Click(object sender, EventArgs e)
{
DataRowView drv = null;
try {
if (dataGridView.CurrentRow == null) { returnnull; }
if (dataGridView.CurrentRow.DataBoundItem == null) { returnnull; }
drv = (DataRowView)dataGridView.CurrentRow.DataBoundItem ;
} catch {
returnnull;
}
return drv.Row;
//DataRow dr = (DataRowView)(dataGridView.CurrentRow.va;
}
ولی خطا می دهد که رویداد کلیک نمی تواند چیزی رو برگرداند
Error 1 'System.Data.DataRow Store.UserInterfaces.SearchCommodity.btnOk_Click(o bject, System.EventArgs)' has the wrong return type
کد مربوط به سطر انتخاب شده در دیتا گرید صحیح است؟
privateDataRow btnOk_Click(object sender, EventArgs e)
{
DataRowView drv = null;
try {
if (dataGridView.CurrentRow == null) { returnnull; }
if (dataGridView.CurrentRow.DataBoundItem == null) { returnnull; }
drv = (DataRowView)dataGridView.CurrentRow.DataBoundItem ;
} catch {
returnnull;
}
return drv.Row;
//DataRow dr = (DataRowView)(dataGridView.CurrentRow.va;
}
با سلام
من در فرم اول فرم دوم رو صدا کردم. در فرم دوم می خوام وقتی روی یه ستون از دیتا گرید کلیک می کنه و دکمه تائید رو می زنه سطر مربوطه به فرم اول برگردانده شود.
کد مربوطه رو در رویداد دکمه تائید به شکل زیر نوشتم
privateDataRow btnOk_Click(object sender, EventArgs e)
{
DataRowView drv = null;
try {
if (dataGridView.CurrentRow == null) { returnnull; }
if (dataGridView.CurrentRow.DataBoundItem == null) { returnnull; }
drv = (DataRowView)dataGridView.CurrentRow.DataBoundItem ;
} catch {
returnnull;
}
return drv.Row;
//DataRow dr = (DataRowView)(dataGridView.CurrentRow.va;
}
ولی خطا می دهد که رویداد کلیک نمی تواند چیزی رو برگرداند
Error 1 'System.Data.DataRow Store.UserInterfaces.SearchCommodity.btnOk_Click(o bject, System.EventArgs)' has the wrong return type
کد مربوط به سطر انتخاب شده در دیتا گرید صحیح است؟
privateDataRow btnOk_Click(object sender, EventArgs e)
{
DataRowView drv = null;
try {
if (dataGridView.CurrentRow == null) { returnnull; }
if (dataGridView.CurrentRow.DataBoundItem == null) { returnnull; }
drv = (DataRowView)dataGridView.CurrentRow.DataBoundItem ;
} catch {
returnnull;
}
return drv.Row;
//DataRow dr = (DataRowView)(dataGridView.CurrentRow.va;
}