Ich habe ein Problem wo ich nicht weiterkomme. Ich möchte das sich eine Form öffnet und alle Datein in dem Ordner auflisten. Dies habe ich auch hinbekommen. Jetzt möchte ich aber, dass eins von mir ausgewähltes Listboxitem per klick auf einen Button, auf einer anderen Form in einer Picturebox angezeigt wird. Mein immoment benutzter Code.
VB.NET-Quellcode
- Imports System.IO
- Public Class Form2
- Dim Pfad As String
- Private Sub KryptonButton1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KryptonButton1.Click
- Form1.PictureBox1.BackgroundImage = KryptonListBox1.SelectedItem << Geht nicht :D
- Me.Close()
- End Sub
- Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
- KryptonListBox1.Items.Clear()
- Pfad = "C:\Fotos"
- Dim dir As New DirectoryInfo(Pfad)
- For Each file As FileInfo In dir.GetFiles
- Me.KryptonListBox1.Items.Add(file.Name)
- Next
- End Sub
- Private Sub KryptonButton2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KryptonButton2.Click
- Me.Close()
- End Sub
- End Class