我使用 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.
我不知道如何绑定到图片。任何想法?非常感谢