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:
  1. Private Sub RandomAllGenie()
  2.         Dim RandGen As New Random
  3.         Dim GenStr As String
  4.  
  5.         Randomize()
  6.         Dim RandNum As Integer = RandGen.Next(1, (NumFiles + 1))
  7.         GenStr = DirName & "\" & GenArr(RandNum)
  8.         picRealGenie.Image = Image.FromFile(GenStr)
  9.  
  10.         picPreview.Image = Image.FromFile(GenStr)
  11.         picPreview.Refresh()
  12.         ApplyGenie()
  13.     End Sub
  14.  
  15.    Private Sub frmGenie_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
  16.         TreeGenie()
  17.         LoadReg()
  18.         RandomAllGenie()
  19.        
  20.     End Sub
  21.  
  22.   Private Sub TreeGenie()
  23.         Dim FolderNode As TreeNode
  24.         Dim FilePath As String
  25.         Dim FolderPath As String
  26.         Dim Xtension As String
  27.         Dim diNext As DirectoryInfo
  28.  
  29.         For Each FolderPath In Directory.GetDirectories(DirName, "*")
  30.             FolderNode = trGenie.Nodes.Add(Path.GetFileName(FolderPath))
  31.  
  32.             For Each FilePath In Directory.GetFiles(FolderPath)
  33.                 Xtension = IO.Path.GetExtension(FilePath)
  34.  
  35.                 If Xtension = ".bmp" OrElse Xtension = ".jpg" OrElse Xtension = ".JPG" OrElse Xtension = ".jpe" OrElse Xtension = ".gif" Then
  36.                     FolderNode.Nodes.Add(Path.GetFileName(FilePath))
  37.                     NumFiles = NumFiles + 1
  38.                     If AutoGenieReg = "Automatic" Then
  39.                         GenArr(NumFiles) = Path.GetFileName(FilePath)
  40.                     End If
  41.                 End If
  42.             Next
  43.         Next
  44.         lblNumFiles.Text = NumFiles.ToString() & " Items In Repository"
  45.     End Sub

Any help would be GreaTlY appreciated