Using WebBrowser Control for simple display

S

SkyHook

I'm experimenting with the WebBrowser control. What I'd like to be able to
do is to change the display/contents of a WebBrowser control
programmatically whenever a ComboBox selection changes. In other words,
this would basically be a Master/Detail presentation with the ComboBox
containing the Master and the WebBrowser containing the detail.

I have everything in place: the controls all work and the display works - to
a point.

The problem is with _changing_ the contents of the WebBrowser control. The
FIRST time I 'populate' the WebBrowser control, everything is fine.
However, when I try to change the WebBrowser control display, (via
ComboBox.SelectedIndexChanged()) nothing happens - that is, the display does
not change. Here's the pertinent code

public void MyWebBrowser_Populate(XmlNode xNode)
{
StringBuilder sb = new StringBuilder();

XmlNodeList nodeList = xNode.SelectNodes("PHONE");

sb.Append("<html><body>");
sb.Append("List.Count[" + nodeList.Count + "]");
sb.Append("<html><body>");

MyWebBrowser.DocumentText = sb.ToString();
}

I have checked 'nodeList' with the debugger and verified that it contains a
different node count on different occasions.

I am thinking that I need to do some sort of 'Clear' or 'Init' on the
WebBrowser control before changing it, but I have not been able to find
anything in the API that will allow me to do that. (MyWebBowser.DocumentText
= ""; does not do it.)

Any help is greatly appreciated.

TIA
 
S

SkyHook

Well I never could make this work. I ended up writing the HTML out to a
file and using the .Url() and .Refresh() from the WebBrowser control API.
If anyone finds a way to do this all in-memory, please post the solution for
us.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top