Hello!![]()
It's me again...![]()
In my app I have a sub named RandomAllGenie which is supposed to select or identify a childnode from a treeview. based on that, it needs to set a picture accordingly in the picturebox.
How can I achieve that ¿
VB Code:
Private Sub RandomAllGenie() Dim RandGen As New Random Dim GenStr As String Randomize() Dim RandNum As Integer = RandGen.Next(1, (NumFiles + 1)) GenStr = DirName & "\" & GenArr(RandNum) picRealGenie.Image = Image.FromFile(GenStr) picPreview.Image = Image.FromFile(GenStr) picPreview.Refresh() ApplyGenie() End Sub Private Sub frmGenie_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load TreeGenie() LoadReg() RandomAllGenie() End Sub Private Sub TreeGenie() Dim FolderNode As TreeNode Dim FilePath As String Dim FolderPath As String Dim Xtension As String Dim diNext As DirectoryInfo For Each FolderPath In Directory.GetDirectories(DirName, "*") FolderNode = trGenie.Nodes.Add(Path.GetFileName(FolderPath)) For Each FilePath In Directory.GetFiles(FolderPath) Xtension = IO.Path.GetExtension(FilePath) If Xtension = ".bmp" OrElse Xtension = ".jpg" OrElse Xtension = ".JPG" OrElse Xtension = ".jpe" OrElse Xtension = ".gif" Then FolderNode.Nodes.Add(Path.GetFileName(FilePath)) NumFiles = NumFiles + 1 If AutoGenieReg = "Automatic" Then GenArr(NumFiles) = Path.GetFileName(FilePath) End If End If Next Next lblNumFiles.Text = NumFiles.ToString() & " Items In Repository" End Sub
Any help would be GreaTlY appreciated![]()




Reply With Quote