I have a question about how I can display an image by getting the image directly from a PictureBox and pass it to a "report.rdlc" using ReportViewer in VB .NET . I have found a code in C # , but I have not managed to show the image when printing the Report .
The code is as follows:
private byte[] GetBytes(Image imageIn)
{
//
//Usamos la clase MemoryStream para contener los bytes que compone la imagen
MemoryStream ms = new MemoryStream();
imageIn.Save(ms, ImageFormat.Png);
//
//Retornamos el arreglo de bytes
return ms.ToArray();
}
This would be converted to VB.NET
Private Function GetBytes(imageIn As Image) As Byte()
Dim ms As New MemoryStream()
imageIn.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg)
Return ms.ToArray()
End Function
At the moment of generating the report I add the following line of code so that according to me, I understand that it is to show in the "report.rdlc" .
Dim factura As New Earticulos
The Earticles class that I created, where I keep the image information and pass it to the report.
factura.logo = GetBytes(pctboxLogo.Image)
What can be wrong?