1
Answer

double clicking on thumbnail problem----plz help me

Aamir Mustafa

Aamir Mustafa

16y
2.2k
1
i m working on an application which stores and retrieves from data base.
when i retrive the images it show them as thumbnail.
i m using sql server data base
i m using list view for the purpose of thumbnail.
i m using tree view for managing images in to data base
my program can create albums in the data base and then i can add images in to  that album.
when i click on album(tree view root), all the images(nodes of tree view) stored in to that album are displayed as thumbnail in the list view
i have created an other form2
and i have placed a picture box on it.
and i want to show image in it when i double click on a thumbnail
i want to use double click event of list view so when i click on a thumbnail then that image should be displayed in an other form2.
but i don't know how to do that...?
method for populating thumbnail
Private Sub PopulateListViewImageList()
        If SqlConn.State = ConnectionState.Closed Then
            SqlConn.Open()
        End If

        ' Just to be sure make sure it was opened
        If SqlConn.State = ConnectionState.Open Then
            ' Create the stored proc command to retrieve the records
            Dim sqlCmd As New SqlCommand("sp_GetPhotoAlbums", SqlConn)
            sqlCmd.CommandType = CommandType.StoredProcedure

            ' Now execute the command
            Dim sqlPhotoAlbum As SqlDataReader = sqlCmd.ExecuteReader()

            Dim nAlbumID As Integer = 0
            ' Keep track of the current album
            Dim nAlbumIndex As Integer = -1
            ' Keep track of the tree index
            ' Keep reading all the records returned
            Dim imgList As New ImageList()
            'Dim array As New ArrayList()

            While (sqlPhotoAlbum.Read())
                'Dim node As TreeNode = Nothing
                'Populate all images
                Dim data As Byte() = CType(sqlPhotoAlbum("photo"), Byte())
                Dim ms As New System.IO.MemoryStream(data, 0, data.Length)
                Dim photo As Image = Image.FromStream(ms) ''

                imgList.Images.Add(sqlPhotoAlbum("Photo").ToString(), photo)

                ListView1.LargeImageList = imgList
            End While

            sqlPhotoAlbum.Close()
end if

i m also sending zip file
kindly help me

Answers (1)