mom slucaju je Firebird)? Ovakav pokusaj:
Code:
DataTable dt = new DataTable();
fbDA3.Fill(dt);
this.openGrid1.DataSource = dt;
openGridPictureBox1.DataBindings.Add(new Binding("Image", dt, "FOTO"));//FOTO je ime kolone
DataTable dt = new DataTable();
fbDA3.Fill(dt);
this.openGrid1.DataSource = dt;
openGridPictureBox1.DataBindings.Add(new Binding("Image", dt, "FOTO"));//FOTO je ime kolone
daje ovo:
Code:
Exception System.FormatException was thrown in debuggee:
Cannot format the value to the desired type.
Exception System.FormatException was thrown in debuggee:
Cannot format the value to the desired type.
Negde sam nasao ovu f-ju za formatiranje:
Code:
using System.IO;
...
private void PictureFormat(object sender, ConvertEventArgs e)
{
Byte[] img = (Byte[])e.Value;
MemoryStream ms = new MemoryStream();
int offset = 78;
ms.Write(img, offset, img.Length - offset);
Bitmap bmp = new Bitmap(ms);
ms.Close();
e.Value = bmp;
}
using System.IO;
...
private void PictureFormat(object sender, ConvertEventArgs e)
{
Byte[] img = (Byte[])e.Value;
MemoryStream ms = new MemoryStream();
int offset = 78;
ms.Write(img, offset, img.Length - offset);
Bitmap bmp = new Bitmap(ms);
ms.Close();
e.Value = bmp;
}
tako da gornji kod sada izgleda ovako:
Code:
DataTable dt = new DataTable();
fbDA3.Fill(dt);
this.openGrid1.DataSource = dt;
Binding imageBinding = new Binding("Image", dt, "FOTO",true);
imageBinding.Format += new ConvertEventHandler(this.PictureFormat);
openGridPictureBox1.DataBindings.Add(imageBinding);
DataTable dt = new DataTable();
fbDA3.Fill(dt);
this.openGrid1.DataSource = dt;
Binding imageBinding = new Binding("Image", dt, "FOTO",true);
imageBinding.Format += new ConvertEventHandler(this.PictureFormat);
openGridPictureBox1.DataBindings.Add(imageBinding);
ali sada izbacuje ovo:
Code:
Exception System.ArgumentException was thrown in debuggee:
Item has already been added.
Exception System.ArgumentException was thrown in debuggee:
Item has already been added.
a IDE pokazuje na liniju: openGridPictureBox1.DataBindings.Add(imageBinding);
Ag + Na -> Xe