Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Imports System.IO
- Public Class frmInterface
- Private Sub frmInterface_Load(sender As Object, e As EventArgs) Handles MyBase.Load
- Me.BackColor = Color.FromArgb(0, 142, 214)
- PopulateImagesList()
- End Sub
- Public Sub PopulateImagesList()
- Try
- Dim di As New DirectoryInfo(Application.StartupPath & "\example\")
- Dim fiArr As FileInfo() = di.GetFiles()
- Dim fri As FileInfo
- For Each fri In fiArr
- If fri.Extension = ".png" Then
- Dim s As String
- s = fri.Name
- lstImages.Items.Add(s.Substring(0, s.Length - 4))
- End If
- Next fri
- Catch ex As Exception
- End Try
- End Sub
- Private Sub lstImages_SelectedValueChanged(sender As Object, e As EventArgs) Handles lstImages.SelectedValueChanged
- Dim img As String = lstImages.SelectedItem.ToString
- Try
- pctrPreview.BackgroundImage = Image.FromFile(Application.StartupPath & "\example\" & img & ".png")
- Catch ex As Exception
- End Try
- End Sub
- End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement