Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Question
Monday, January 11, 2010 6:35 AM
hi friendz i want to display image in picture box from data table.
i am using below code it shows error.
DataRow
dRow = contApplnDBDataSet1.Tables["tblEmployeeDetail"].Rows[0];
pictureBox1.Image = dRow.ItemArray.GetValue(0);
All replies (7)
Monday, January 11, 2010 7:05 AM âś…Answered | 1 vote
//TEST FOLLOWING
DataRow dRow = contApplnDBDataSet1.Tables["tblEmployeeDetail"].Rows[inc];
txtEmpName.Text=dRow[0].ToString();
txtEmpID.Text = dRow[1].ToString();
txtEmpDesig.Text = dRow[2].ToString();
txtPPNum.Text = dRow[3].ToString();
txtIqamaNum.Text = dRow[4].ToString();
txtNationality.Text = dRow[5].ToString();
txtDOJ.Text = dRow[6].ToString();
txtAddrs.Text = dRow[7].ToString();
txtPhoneNum.Text = dRow[8].ToString();
pictureBox1.Image = Image.FromStream(new MemoryStream((byte[])dRow[9]));
With best regards, Yasser Zamani
Monday, January 11, 2010 6:41 AM | 1 vote
pictureBox1.Image = Image.FromStream(new MemoryStream((byte[])contApplnDBDataSet1.Tables["tblEmployeeDetail"].Rows[0][0]));
With best regards, Yasser Zamani
Monday, January 11, 2010 6:49 AM
thanks mr.Yasser
ir shows followining error
Error 1 The type or namespace name 'DllImport' could not be found (are you missing a using directive or an assembly reference?) D:\VC#.Net\datavicoding\datavicoding\Form2.cs 16 10 datavicoding
Error 2 The best overloaded method match for 'System.Drawing.Image.FromStream(System.IO.Stream)' has some invalid arguments D:\VC#.Net\Backup\Construction Application(24.12)\Construction Application\EmployeeDetailView.cs 47 33 Construction Application
Error 3 Argument '1': cannot convert from 'MemoryStream' to 'System.IO.Stream' D:\VC#.Net\Backup\Construction Application(24.12)\Construction Application\EmployeeDetailView.cs 47 50 Construction Application
Monday, January 11, 2010 6:58 AM
this is my complete code.
it shows , there no row at position 9
DataRow
dRow = contApplnDBDataSet1.Tables["tblEmployeeDetail"].Rows[inc];
txtEmpName.Text=dRow.ItemArray.GetValue(0).ToString();
txtEmpID.Text = dRow.ItemArray.GetValue(1).ToString();
txtEmpDesig.Text = dRow.ItemArray.GetValue(2).ToString();
txtPPNum.Text = dRow.ItemArray.GetValue(3).ToString();
txtIqamaNum.Text = dRow.ItemArray.GetValue(4).ToString();
txtNationality.Text = dRow.ItemArray.GetValue(5).ToString();
txtDOJ.Text = dRow.ItemArray.GetValue(6).ToString();
txtAddrs.Text = dRow.ItemArray.GetValue(7).ToString();
txtPhoneNum.Text = dRow.ItemArray.GetValue(8).ToString();
pictureBox1.Image =
Image.FromStream(new MemoryStream((byte[])contApplnDBDataSet1.Tables["tblEmployeeDetail"].Rows[9][9]));
Monday, January 11, 2010 7:10 AM
thanks Mr.Yasser
it is working fine............
Monday, January 11, 2010 7:11 AM
You're welcome.
Have a nice day!With best regards, Yasser Zamani
Monday, January 11, 2010 7:13 AM
one more help mr.yasser...
in picture box ,tha complete image shoul be displayed.
nut now full image is not display.......