0

bindingsource を使用して、画像フォーム datagridview を画像にバインドします。

picProductImage.DataBindings.Add("Image", bsBase, dsProduct.Product.ImageColumn.ColumnName,true, DataSourceUpdateMode.OnValidation,"","binary")

しかし、私は例外を受け取ります:

    the following exception occurred in the DataGridView:
System.ArgumentException: Parameter is not valid. At System.drawing.Image.Fromstream(Stream stream, Boolean use EmbeddedColorManagement, Boolean validateImageData)
at System.Drawing.ImageConverter.convertFrom(ITypeDescriptorContext context, CultureInfo culture, Object value)
at System.Windows.Forms.Formatter.FormatObjectInternal(Object value, Type targetType, TypeConvert sourceConverter, TypeConverter targetConverter,String formatString, IFormatProvider formatInfo, Object formattedNullValue)
at System.Windoes.Forms.Formatter.FormatObject(Object value, Type targetType, TypeConverter sourceConverter, TypeConverter targetConverter, String formatString, IFormatProvider fomatInfo, Object formattedNullValue, Object dataSourceNullvalue)
at
System.Windows.Form.DatagridViewCell.GetFormattedValue(Object value, Int32 rowIndex, DataGridViewCellStyle& cellStyle, TypeConverter valueTypeConverter, TypeConverter formattedValueTypeConverted, DataGridViewDataErrorContexts context)
To replace this default dialog please handle the DataError event.

画像にバインドする方法がわかりません。何か案が?どうもありがとう

4

0 に答える 0