aamir55 0 Newbie Poster

i m using this small application for the purpose of loading multiple images from disk and then show them as thumbnail
i m using List View for this purpose.
my application is generating thumbnails successfully
but i modified such that when i double click on a thumbnail and that image should be displayed in another Form
I added a picture box on form2 for this purpose.
but this task is not going well bcoz when i double click on an thumbnail the that image doesn't displayed on form2.
For this purpose i used a method ViewImageInEditor()
code is below for this method.
Sub ViewImageInEditor()
Dim disimg As Bitmap
Dim frm2 As New Form2
If IsNothing(frm2.Dimg.Image) = False Then
Dim ed As New Form2

Dim lvitem As ListViewItem
For Each lvitem In Me.lvImgs.SelectedItems

Dim n() As String
n = Split(lvitem.Text, vbCrLf)

Try

disimg = New Bitmap(SelectedDirectory & "\" & n(0))
ed.Dimg.Image = disimg
ed.Dimg.SizeMode = PictureBoxSizeMode.CenterImage

ed.Text = n(0) & " - Image Editor v1.0"
Catch Ex As Exception
MsgBox(Ex.Message)
End Try

'To Make the Base = 1 instead of 0
imgsCurnCnt = lvitem.Index + 1 & "/" & Me.lvImgs.Items.Count

Next

StartTime = Now

ed.ShowDialog()
disimg.Dispose()

Else
MsgBox("Please Select the Image First !", MsgBoxStyle.Exclamation)
End If

End Sub
and i have called it here

Private Sub lvImgs_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles lvImgs.DoubleClick
ViewImageInEditor()
End Sub

kindly tell me what is the problem with code
i m also sending u whole code for this purpose.

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.