datagridviewer โช้ว์รูปที่ Picturebox
2 posters
หน้า 1 จาก 1
datagridviewer โช้ว์รูปที่ Picturebox
if (txtSearch.Text.Trim() == "")
{
MessageBox.Show("กรุณาระบุรหัสหรือชื่อก่อน !!! ", "ข้อผิดพลาด", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
IHuman = from c in db.Humans
where c.IDCardName.Contains(txtSearch.Text.Trim())
|| c.FitstName.Contains(txtSearch.Text.Trim())
orderby c.FitstName
select c;
if (IHuman.Count() > 0)
{
tsEdit.Enabled = true;
dgvCustomerList.DataSource = IHuman.ToList();
}
else
{
ClearHuman();
dgvCustomerList.DataSource = null;
MessageBox.Show("เงื่อนไขที่คุณป้อน ไม่มีข้อมูลลูกค้า !!!", "ผลการค้นหา", MessageBoxButtons.OK, MessageBoxIcon.Information);
txtSearch.Focus();
txtSearch.SelectAll();
}
FormatDgvCustomerList();
}
private void FormatDgvCustomerList()
{
if (dgvCustomerList.RowCount > 0)
{
dgvCustomerList.Columns[0].HeaderText = "ระหัสบัตรประชาชน";
dgvCustomerList.Columns[1].HeaderText = "อำเภอ";
dgvCustomerList.Columns[0].Width = 180;
dgvCustomerList.Columns[1].Width = 235;
}
}
private void dgvCustomerList_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
if (e.RowIndex == -1)
{
return;
}
mskIDCard.Text = dgvCustomerList.Rows[e.RowIndex].Cells["IDCardName"].Value.ToString();
txtAmphur.Text = dgvCustomerList.Rows[e.RowIndex].Cells["AmphurCard"].Value.ToString();
ทั้งหมด ส่วนนี้ ก็แสดงได้สำเร็จ แต่ ส่วนที่ติด จริงๆ คือ ใช่ช่อง รูปภาพ ผมต้องการให้ Doubleclick ที่DataGridview นั้น แล้วแสดงข้องมูลรูปภาพของพนักงานในแถวนั้น
ทำไม่ได้ครับ
picHumanPicture.image=????????.. .Rows.Item(e.RowIndex).Cells(.Value ตรงนี้ ต้องเขียนอย่างไรครับ
ปล. ในSQL Database นะ ครับ
sql ImageNo รันตัวเลข auto คับ
IDCardNameImage ที่เก็บไฟล์รูปคับ
FileName ที่เก็บนามสกุลรูปคับ
picHumanPicture คือ Picturebox ครับ
{
MessageBox.Show("กรุณาระบุรหัสหรือชื่อก่อน !!! ", "ข้อผิดพลาด", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
IHuman = from c in db.Humans
where c.IDCardName.Contains(txtSearch.Text.Trim())
|| c.FitstName.Contains(txtSearch.Text.Trim())
orderby c.FitstName
select c;
if (IHuman.Count() > 0)
{
tsEdit.Enabled = true;
dgvCustomerList.DataSource = IHuman.ToList();
}
else
{
ClearHuman();
dgvCustomerList.DataSource = null;
MessageBox.Show("เงื่อนไขที่คุณป้อน ไม่มีข้อมูลลูกค้า !!!", "ผลการค้นหา", MessageBoxButtons.OK, MessageBoxIcon.Information);
txtSearch.Focus();
txtSearch.SelectAll();
}
FormatDgvCustomerList();
}
private void FormatDgvCustomerList()
{
if (dgvCustomerList.RowCount > 0)
{
dgvCustomerList.Columns[0].HeaderText = "ระหัสบัตรประชาชน";
dgvCustomerList.Columns[1].HeaderText = "อำเภอ";
dgvCustomerList.Columns[0].Width = 180;
dgvCustomerList.Columns[1].Width = 235;
}
}
private void dgvCustomerList_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
if (e.RowIndex == -1)
{
return;
}
mskIDCard.Text = dgvCustomerList.Rows[e.RowIndex].Cells["IDCardName"].Value.ToString();
txtAmphur.Text = dgvCustomerList.Rows[e.RowIndex].Cells["AmphurCard"].Value.ToString();
ทั้งหมด ส่วนนี้ ก็แสดงได้สำเร็จ แต่ ส่วนที่ติด จริงๆ คือ ใช่ช่อง รูปภาพ ผมต้องการให้ Doubleclick ที่DataGridview นั้น แล้วแสดงข้องมูลรูปภาพของพนักงานในแถวนั้น
ทำไม่ได้ครับ
picHumanPicture.image=????????.. .Rows.Item(e.RowIndex).Cells(.Value ตรงนี้ ต้องเขียนอย่างไรครับ
ปล. ในSQL Database นะ ครับ
sql ImageNo รันตัวเลข auto คับ
IDCardNameImage ที่เก็บไฟล์รูปคับ
FileName ที่เก็บนามสกุลรูปคับ
picHumanPicture คือ Picturebox ครับ
rungsak- จำนวนข้อความ : 3
Join date : 05/02/2011
หน้า 1 จาก 1
Permissions in this forum:
คุณไม่สามารถพิมพ์ตอบ
|
|