fill picturebox via xml ref -Newbie

dpan

Active member
Joined
Nov 22, 2005
Messages
28
Programming Experience
Beginner
Ok I'm tring to load an image that is refernced in an xml file.
VB.NET:
Public Class Form1

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        ConfigOpt.Initialize("MyConfig.cfg")
        ReadConfigValues()
    End Sub
    Private Sub ReadConfigValues()
        ' Im sure this is where I'm going wrong but I can't figure out the right syntax
        PictureBox1.Image = Image.FromFile(My.Computer.FileSystem.CurrentDirectory(Boolean.Parse(ConfigOpt.GetOption("Banner1Image"))))
    End Sub

End Class

my xml File
VB.NET:
<?xml version="1.0" standalone="yes"?>
 <ConfigOpt>
   <ConfigValues>
     <OptionName>Banner1Image</OptionName>
     <OptionValue>/banners/animated1.gif</OptionValue>
   </ConfigValues>

 </ConfigOpt>

most of the code I got from: http://www.codeproject.com/vb/net/ConfigOpt.asp
 
found and fixed my error:
Dim imagefile As String = ConfigOpt.GetOption("Banner1Image")

PictureBox1.Image = Image.FromFile(imagefile)
 
Back
Top