Hello everyone! I’m trying to return images from the database, but I don’t know how I can put the images (which are converted to bytes) in the CustomWallpaper control. Someone can help me? Thanks!
So, i just found the solution. I will post it here for those who wants to retrieve an image from the database. Also thanks for the Staff that helped me with some code!
Dim imagem As Byte()
Sql = “SELECT image FROM imagens WHERE user='” & LkID & “‘”
dt = SqlDataTable(Sql, LerMy)
Dim imageListEntries As ImageListEntry() = New ImageListEntry(dt.Rows.Count – 1) {}
Dim count = 0
For Each imagens In dt.Rows
imagem = dt.Rows(count)(0)
Dim ms As MemoryStream = New MemoryStream(imagem)
imageListEntries(count) = New ImageListEntry(Image.FromStream(ms))
count = count + 1
Next
Me.CustomWallpaper1.Images = imageListEntries
Here is the result of the attached sample with a bitmap changed to use new Bitmap(Image.FromStream()). This is a common .NET drawing issue, not a Wisej issue.
Use New Bitmap(Image.FromStream(stream)) or don’t use the same stream twice.
Hi Ruben,
the code you posted cannot work as is.
Best regards
Frank
Hi Ruben,
I have created a small demo application where you can upload images to a Custom Wallpaper.
It should help you to transfer the logic to your requirement.
Please let me know if you have any further questions.
Best regards
Frank
Please login first to submit.