473,394 Members | 1,769 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Strange String Question

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?

Thank you,
Susan
Nov 16 '05 #1
5 1473
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
Nov 16 '05 #2
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


Nov 16 '05 #3
Susan <Su***@discussions.microsoft.com> wrote:
Here's my code (it's in the listbox SelectedIndexChanged event):
(Please excuse any typos. I can't cut and paste.)


Why not, out of interest?

You haven't shown the *relevant* code - like exactly how hPath is
fetched, etc.

Please see http://www.pobox.com/~skeet/csharp/incomplete.html

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 16 '05 #4
"Jon Skeet [C# MVP]" wrote:
Susan <Su***@discussions.microsoft.com> wrote:
Here's my code (it's in the listbox SelectedIndexChanged event):
(Please excuse any typos. I can't cut and paste.)


Why not, out of interest?


I post on the newsgroups at home, but all my code is at work. :)

Here's the code:
//GlobalClass is just a class with global variables like where the help
files are stored
GlobalClass g = new GlobalClass();
string hPath = g.HelpPath //=c:\bob\help
string path = helpprovider.namespace //=c:\\bob\\help

Is that what you needed? I have fixxed the problem by doing a replace, but
was still curious why one works without it while the other doesn't.

Thanks again!
Susan
Nov 16 '05 #5
Susan <Su***@discussions.microsoft.com> wrote:
Susan <Su***@discussions.microsoft.com> wrote:
Here's my code (it's in the listbox SelectedIndexChanged event):
(Please excuse any typos. I can't cut and paste.)
Why not, out of interest?


I post on the newsgroups at home, but all my code is at work. :)


That shouldn't make a difference when it comes to short but complete
examples though - short programs are usually short enough that you can
type them up at home :)
Here's the code:
//GlobalClass is just a class with global variables like where the help
files are stored
GlobalClass g = new GlobalClass();
string hPath = g.HelpPath //=c:\bob\help
string path = helpprovider.namespace //=c:\\bob\\help
So if you print hPath and path to the console, do they look the same or
different?
Is that what you needed? I have fixxed the problem by doing a replace, but
was still curious why one works without it while the other doesn't.


No, I need a *complete* program - one that I can run and see the same
problem that you do.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 16 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Jim Irvine | last post by:
I have a small database made up of 2 tables. I have a report that is driven from a query. On the report are a couple of fields linked to memo boxes in the table. Everytime I run the report I get...
4
by: William Sullivan | last post by:
I have an extremely weird problem that I have no idea how to approach. I have a simple page with a search textbox and a search button. The button causes a postback, where I perform the search and...
8
by: WhiteWizard | last post by:
Have we got a STRANGE one going here. We converted from 1.1 to 2.0 about 2 weeks ago and this has been a problem since then...but only on SOME machines in our development group. The application...
2
by: peter | last post by:
Hi, I have very strange situation but first description ;) I have: 1) project in VB.NET, in this f.e. 1 function: Public Function Login(ByVal UserName As String, ByVal UserPassword As...
11
by: Mike C# | last post by:
Hi all, I keep getting a strange error and can't pin it down. The message is: This application has requested the Runtime to terminate it in an unusual way. Please contact the application's...
4
by: schnupfy | last post by:
Hi, I am not used to python and I am wondering about this thing: If I execute this from the shell: /root/mk/services.py 192.168.1.101 critical "192.168.1.101 192.168.1.101...
2
by: zacks | last post by:
I am developing an app in VS2005 (actually in VB.NET but this question, I believe, would apply to any .NET language) that is used to design the contents of an XML file. One of potential items that...
8
by: FBM | last post by:
Hi there, I am puzzled with the behavior of my code.. I am working on a networking stuff, and debugging with eclipse (GNU gdb 6.6-debian).. The problem I am experiencing is the following: ...
16
by: Heinrich Pumpernickel | last post by:
i got the following strange extra question in a written test today . since the test was abt c/c++ i guess this is on topic here --8<-- 22) Consider the following quote: "If Mickey's a...
4
by: maria | last post by:
I only use C++ with Visual Studio 6.0 for string manipulations in thousands of HTML pages on my website. Many times, the output files of many of my C++ programs contain a spanish question mark (¿)...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.