We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

how to use carousel control for using database in vb.net (window form)

Hi!

    i want to create application pic view using database.i dont know to code for carousel..can you give simple application carousel using database.thank.

1 Reply

KR Kannan R Syncfusion Team December 5, 2013 04:12 PM UTC

Hi Amat,

 

Thank you for using Syncfusion products.

 

Query

Comments

i want to create application pic view using database.

 

can you give simple application carousel using database

Yes, we have prepared sample that loads carousel child items background image from Database.

 

Steps:

 

1)     New SQL database and table needs to be created.

2)     Need to save image in created database table as byte array value.

 

Code Snippet:[VB]

 

Dim stream As New MemoryStream()

 

Me.panel1.BackgroundImage.Save(stream,System.Drawing.Imaging.ImageFormat.Jpeg)

 

Dim pic() As Byte=stream.ToArray()

 

com.Parameters.AddWithValue("@Pic", pic)

 

 

3)     And to load image in carousel, need to retrieve and store saved image in DataTable.

4)     Carousel child panel image can be defined with this retrieved image.

 

Code Snippet:[VB]

 

dp.Fill(ds, "MyImages")

Dim myRow As DataRow

myRow = ds.Tables("MyImages").Rows(0)

 

MyData = CType(myRow("fldPic"), Byte())

 

Dim stream As New MemoryStream(MyData)

'With the code below, you are in fact converting the byte array of image

'to the real image.

Me.panel2.BackgroundImage = Image.FromStream(stream)

 

       

 

Please find the sample in below location.

 

Sample Location: Carosel DB.zip

 

Note:

 

It is needed to set SQL DB and its DataSource settings based on your machine.

 

 

Please let us know if it helps,

 

Regards,

Kannan.R


Loader.
Live Chat Icon For mobile
Up arrow icon