Hi

I am hoping someone might be able to shed some light on my issue.

I have some BLOB images within a small, 9 row, database and I simply want to run through the database and sequentially place each separate image into 9 picture boxes. I have tried with a picturebox array but it's placing the same image into each picturebox!

This is the code I have:

Dim group() As PictureBox = New PictureBox() {Me.pic1, Me.pic2, Me.pic3, Me.pic4, Me.pic5, Me.pic6, Me.pic7, Me.pic8, Me.pic9}
        
            For i As Integer = 0 To UBound(group)
                Dim byteImage() As Byte = ds.Tables("tblTops").Rows(0)("topImage")
                Dim stmImage As New MemoryStream(byteImage)

                group(i).Image = Image.FromStream(stmImage)
            Next

I know it's something to do with the .Rows(0) but I'm not sure what to put instead?

Any help would be appreciated

Thanks

Member Avatar for Unhnd_Exception
For i as Integer = 0 to ds.tables("tblTops").Rows.Count - 1 
    If i > ubound(group) then exit for
    ImageStream = new memorystream(ctype(ds.tables("tblTops").rows(i)("topimage"),byte())
    group(i) = image.fromstream(ImageStream)
Next

Thank you that has got it working!

much appreciated!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.