Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
PictureBox
Message
 
To
All
General information
Forum:
ASP.NET
Category:
The Mere Mortals .NET Framework
Title:
PictureBox
Miscellaneous
Thread ID:
00888944
Message ID:
00888944
Views:
52
I have created a form with mmPictureBox.

Following an example at Akadia.com, I have created a databinding as such in the constructor method of an instance of mmMaintenanceForm:


InitializeComponent();

// this is essentially the code from Akadia.com, with only a minor
// change of my own dataset.
this.dsEmployeePhotos = this.oEmployeePhotosBiz.GetEmployeePhotos();
Binding bdPhoto = new Binding("Image", this.dsEmployeePhotos, "Photo");
bdPhoto.Format += new ConvertEventHandler(this.PictureFormat);
mmPictureBox1.DataBinding.Add(bdPhoto);
// the constructor method ends here
....
private void PictureFormat(object sender, ConvertEventArgs e)
{
// e.Value is the original value
Byte[] img = (Byte[])e.value;
MemoryStream ms = new MemoryStream();
// I have also tried int offset = 0
int offset = 78;
ms.Write(img, offset, imgLength - offset);
Bitmap bmp = new Bitmap(ms);
ms.Close();

// Writes the new value back
e.Value = bmp;
}

The exception message I receive is "Cannot bind to property or column Photo on DataSource. Parameter name: dataMember". I have checked the that the column is included in my SELECT statement and have not misspelled it.

Any help is appreciated.

Thanks,

Thomas Allan
Thomas Allan
Next
Reply
Map
View

Click here to load this message in the networking platform