Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
PictureBox
Message
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
The Mere Mortals .NET Framework
Titre:
PictureBox
Divers
Thread ID:
00888944
Message ID:
00888944
Vues:
53
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
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform