Here's my code (it's in the listbox SelectedIndexChanged event):
(Please excuse any typos. I can't cut and paste.)
XmlDocument doc = new XmlDocument();
XmlNode xNode;
\\NameSpace = HelpProvider.NameSpace
doc.Load(NameSpace + "WebHelp\\" + iPath);
XmlElement root = doc.DocumentElement;
int x = lstbbResults.SelectedIndex;
string tmp = lstbResults.Items[x].ToString();
tmp = tmp.TrimStart(null);
xNode = root.SelectSingleNode(descendant::topic[@name='" + tmp + "']");
XmlAttributeCollection attrColl = xNode.Attributes;
//here's where it starts getting wierd
string filePath = NameSpace + "WebHelp\\";
filePath = filePath + attrColl["url"].Value.ToString();
//hPath = the same as NameSpace, but is gotten from a Globals class
string filePath2 = hPath + attrColl["url"].Value.ToString();
//this one does not display the file
if (File.Exists(filePath))
{
axWebBrowser.Navigate(filePath, blah, blah, blah);
}
//this one displays the file
if (File.Exists(filePath2))
{
//ctrlTemp is a user control with an AxWebBrowser
axWebBrowser.Navigate(filePath2, blah, blah, blah);
}
Thanks for your help.
Susan
"Jon Skeet [C# MVP]" wrote:
Susan <Su***@discussions.microsoft.com> wrote: When I read a string hPath from a global class (hPath = g.helpPath), the
watch says hPath = "C:\Help\SusanHelp". When I get the NameSpace from the
HelpProvider on the form (strNameSpace = hpHelp.NameSpace), the watch on
strNameSpace = "C:\\Help\\SusanHelp". Why are the watches different? The
problem arrises when I append a url (ex. "Cats/Gorbash.htm") to strNameSpace
and send this path to the AxWebBrowser, I get an error. This does not occur
when I append the url to hPath and send it to AxWebBrowser. I need to use
strNameSpace. Any ideas on how to fix this?
I'd ignore what the watch says and write the value out to a log file or
something similar if you really want to know what's going on.
The rest of your problem sounds very odd though. Could you post a short
but complete program which demonstrates the problem?
See http://www.pobox.com/~skeet/csharp/complete.html for details of
what I mean by that.
--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too