Witam, mam kolejny problem... Teraz chodzi o wczytywanie obrazku WWW który pobiera link z XML'a i daje do pictureBox'a. Tylko że przy jednej formie się wczytuje, a na drugiej nie.
Formapierwsza.cs
private void button1_Click(object sender, EventArgs e)
{
if (listBox1.SelectedItem != null)
{
WesOS wes = new WesOS();
XmlDocument xml = new XmlDocument();
xml.Load(Application.StartupPath + "\system.xml");
XmlNodeList node = xml.SelectNodes("//system/settings/web/wallpaper/wall");
if ((string)listBox1.SelectedItem == "1")
{
foreach (XmlElement enode in node)
{
string id = enode.GetAttribute("id");
if (id == "1")
{
wes.zmianaxml("1");
}
}
}
else if ((string)listBox1.SelectedItem == "2")
{
foreach (XmlElement enode in node)
{
string id = enode.GetAttribute("id");
if (id == "2")
{
}
}
}
}
}
Forma2.cs
<code class="c#"> public void zmianaxml(string value)
{
XmlDocument xml = new XmlDocument();
xml.Load(Application.StartupPath + "\\system.xml");
XmlNodeList node = xml.SelectNodes("//system/settings/web/wallpaper/wall");
foreach (XmlElement enode in node)
{
string id = enode.GetAttribute("id");
if (id == value)
{
string attr = enode.GetAttribute("url");
pictureBox1.Load(attr);
MessageBox.Show("Done!");
}
}
}
XML
<system>
<settings>
<desktop>
<wallpaper url="1.jpg"/>
</desktop>
<web>
<wallpaper>
<wall id="1" url="1.jpg" preview="1preview.jpg" author="Wesseb"/>
<wall id="2" url="2.jpg" preview="2preview.jpg" author="Wesseb"/>
</wallpaper>
</web>
</settings>
<user>
</user>
</system>
Błąd polega na tym, że pictureBox pierwszej formy się ładuje (preview), ale gdy kliknę dodaj na drugą formę, pisze "Done!", lecz nic się nie zmieniło...