.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Code Snippets >> Visual Studio >> Post New Resource Bookmark and Share   

 Subscribe to Code Snippets

Picture Viewer

Posted By:Abraham       Posted Date: August 26, 2010    Points: 10    Category: Visual Studio    URL: http://www.dotnetspark.com  

Click the Listbox item , it display the Picture in the Picture box. Change the picturebox property SizeMode="StretchMode"
 

 
Picture Viewer using listbox control and it use the if loop
Public Class DisPic

    Private Sub ListBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged
        If (ListBox1.SelectedItem.ToString.Equals("Jesus1")) Then
            PictureBox1.Load("G:\Abraham\DotNet\VinoProject\Images\01.jpg")
        End If
        If (ListBox1.SelectedItem.ToString.Equals("Jesus2")) Then
            PictureBox1.Load("G:\Abraham\DotNet\VinoProject\Images\02.jpg")
        End If
        If (ListBox1.SelectedItem.ToString.Equals("Jesus3")) Then
            PictureBox1.Load("G:\Abraham\DotNet\VinoProject\Images\03.jpg")
        End If
        If (ListBox1.SelectedItem.ToString.Equals("Jesus4")) Then
            PictureBox1.Load("G:\Abraham\DotNet\VinoProject\Images\04.jpg")
        End If
        If (ListBox1.SelectedItem.ToString.Equals("Jesus5")) Then
            PictureBox1.Load("G:\Abraham\DotNet\VinoProject\Images\05.jpg")
        End If
        If (ListBox1.SelectedItem.ToString.Equals("Jesus6")) Then
            PictureBox1.Load("G:\Abraham\DotNet\VinoProject\Images\06.jpg")
        End If
        If (ListBox1.SelectedItem.ToString.Equals("Jesus7")) Then
            PictureBox1.Load("G:\Abraham\DotNet\VinoProject\Images\07.jpg")
        End If
        If (ListBox1.SelectedItem.ToString.Equals("Jesus8")) Then
            PictureBox1.Load("G:\Abraham\DotNet\VinoProject\Images\08.jpg")
        End If

    End Sub

    
End Class

     

Further Readings:

Responses

No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More code samples in C#, ASP.Net, Vb.Net and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend