.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 ForLoop(lessCode)

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

view the picture in the picturebox depends open the selected item in the Listbox
 

ViewPicture 
It contains less code because it use the for loop
Public Class DisPicture2

    Private Sub ListBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged
        Dim a As Integer
        For a = 0 To 7
            If ListBox1.SelectedIndex.Equals(a) Then
                PictureBox1.Load("G:\Abraham\DotNet\VinoProject\Images\0" & (a + 1).ToString & ".jpg")
            End If
        Next
    End Sub

    Private Sub PictureBox1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox1.Click

    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