22-04-23, 09:09 PM
لدي كود دالة التالية وظيفتها عرض بيانات عندما اضغط علي زر
لماذا لاتعرض
هدا كود استقبال دالة
لماذا لاتعرض
كود :
public void SHOW_DETAILES(string id)
{
DataTable dt = new DataTable();
SqlDataAdapter adp = new SqlDataAdapter("select *from suppliers where sup_code='" + id + "' ", Class1.con);
adp.Fill(dt);
if (dt.Rows.Count == 0)
{
MessageBox.Show("المورد غير موجود يرجي التاكد ", "رسالة تنبيه ", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
else
{
int i = BindingContext[dt].Position;
sup_code.Text = dt.Rows[i]["sup_code"].ToString();
sup_name.Text = dt.Rows[i]["sup_name"].ToString();
sup_address.Text = dt.Rows[i]["sup_address"].ToString();
sup_tel.Text = dt.Rows[i]["sup_tel"].ToString();
name_company.Text = dt.Rows[i]["name_company"].ToString();
notes.Text = dt.Rows[i]["notes"].ToString();
btn_edit.Enabled = true;
btn_del.Enabled = true;
btn_save.Enabled = false;
}
}
كود :
private void dataGridView1_Click(object sender, EventArgs e)
{
Frm_Suppliers frm = new Frm_Suppliers();
if (dataGridView1[0, dataGridView1.CurrentRow.Index].Selected == true)
{
frm.SHOW_DETAILES(Convert.ToString(dataGridView1.CurrentRow.Cells[1].Value));
}
}