I am interested in changing an image in an HTMLUIControl after the page has been rendered.
The following statement does not appear to work:
this.image1.Attributes["src"].Value = "..\\..\\btnStep3d0.bmp";
It gives me this error:
“Object reference not set to an instance of an object.”
I made sure that I had instanciated image1. The following code was executed before trying to add an image to the document.
public void htmluiControlLoadFinished()
{
WireElements();
}
private void WireElements()
{
try
{
htmlelements = htmlCtrl.Document.GetElementsByUserIdHash();
this.image1 = htmlelements["Image1"] as BaseElement;
...
Here is the HTML Code I used (abbreviated):
I also tried loading the document without attempting to change the image. It worked fine. It loaded images directly hard coded into the html document. I just cannot change out the image after it is loaded.
I also wondered whether not having quotes on the statement was making a difference. So, I tried the following statement:
this.image1.Attributes["src"].Value = "\"..\\..\\ImageName.bmp\"";
I got the same error as above. Can someone see something in my code that is incorrect?
Any help or advice would be appreciated.