Click here to Skip to main content
15,891,316 members
Home / Discussions / C#
   

C#

 
AnswerRe: how to fix a menustrip ? Pin
ShermansLagoon12-Feb-07 23:16
ShermansLagoon12-Feb-07 23:16 
QuestionRe: how to fix a menustrip ? Pin
test12345013-Feb-07 2:46
test12345013-Feb-07 2:46 
AnswerRe: how to fix a menustrip ? Pin
ShermansLagoon13-Feb-07 7:13
ShermansLagoon13-Feb-07 7:13 
Question.NET 2.0 UserControl Adorners Override Please Help!! Pin
@FrankDrebin@12-Feb-07 12:56
@FrankDrebin@12-Feb-07 12:56 
QuestionHow to set node value in XMLDocument [modified] Pin
AndrusM12-Feb-07 12:51
AndrusM12-Feb-07 12:51 
AnswerRe: How to set node value in XMLDocument Pin
gauthee12-Feb-07 17:01
gauthee12-Feb-07 17:01 
GeneralRe: How to set node value in XMLDocument Pin
AndrusM13-Feb-07 1:50
AndrusM13-Feb-07 1:50 
GeneralRe: How to set node value in XMLDocument Pin
Stefan Troschuetz13-Feb-07 6:19
Stefan Troschuetz13-Feb-07 6:19 
AndrusM wrote:
but this causes compile error.
Why ?


If you get errors or exceptions, it is always a good idea to tell us exactly what they are. Simply saying "it does not work" or "it causes error/exceptions" makes it harder to help.

Anyway, in the given case it is quite obvious:
1. The XmlDocument class provides no SelectNode method. There are only the SelectNodes and SelectSingleNode methods. You have to use the latter.
2. The starting quote for the XPath expression is missing.
3. There is no type called Node. It's XmlNode.
4. The XmlNode class provides no InnerHTML property. There are a InnerText and InnerXml property. You could use both.

After applying the above changes your code should compile, but it won't work because your XPath expression will not select the element you want. The reason is that all elements in your XML file are qualified with the 'http://schemas.microsoft.com/sqlserver/reporting/2005/01/reportdefinition' namespace through the xmlns declaration on the root element. Your XPath expression will match only unqualified elements. To resolve this issue use the overload of the XmlDocument.SelectSingleNode method that takes an XmlNamespaceManager object. The MSDN topic of the method contains an example that shows you how to do this.

Finally, a small hint (not meant to offend you). You should definitely learn to work with the documentation. It extensively documents the classes of the .NET FRamework class library and contains many examples on how to use them. For example, it would have been plain visible why your code cannot compile by taking a look at the documentation of the classes in question (a method or property that is not listed and described there, is very unlikely to exist and therefore its use will cause compile errors). So, first try to solve your problem by looking at the documentation. If you cannot come up with a solution, try the search engine of your choice. If still no solution, come here and feel free to ask. This process seems time-consuming at the beginning, but it helps alot improving your programming skills and with some practise it get faster and faster.


"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook

www.troschuetz.de

GeneralRe: How to set node value in XMLDocument Pin
AndrusM13-Feb-07 8:48
AndrusM13-Feb-07 8:48 
GeneralRe: How to set node value in XMLDocument [modified] Pin
Stefan Troschuetz13-Feb-07 9:19
Stefan Troschuetz13-Feb-07 9:19 
GeneralRe: How to set node value in XMLDocument Pin
AndrusM14-Feb-07 6:18
AndrusM14-Feb-07 6:18 
GeneralRe: How to set node value in XMLDocument Pin
Stefan Troschuetz14-Feb-07 7:36
Stefan Troschuetz14-Feb-07 7:36 
GeneralRe: How to set node value in XMLDocument Pin
AndrusM14-Feb-07 9:23
AndrusM14-Feb-07 9:23 
GeneralRe: How to set node value in XMLDocument Pin
Stefan Troschuetz14-Feb-07 9:59
Stefan Troschuetz14-Feb-07 9:59 
GeneralRe: How to set node value in XMLDocument Pin
AndrusM14-Feb-07 10:23
AndrusM14-Feb-07 10:23 
GeneralRe: How to set node value in XMLDocument Pin
Stefan Troschuetz14-Feb-07 21:13
Stefan Troschuetz14-Feb-07 21:13 
GeneralRe: How to set node value in XMLDocument Pin
AndrusM15-Feb-07 6:43
AndrusM15-Feb-07 6:43 
GeneralRe: How to set node value in XMLDocument Pin
Stefan Troschuetz15-Feb-07 7:32
Stefan Troschuetz15-Feb-07 7:32 
GeneralRe: How to set node value in XMLDocument Pin
AndrusM15-Feb-07 8:13
AndrusM15-Feb-07 8:13 
QuestionConvert DataReader to Entity list Pin
AndrusM12-Feb-07 12:49
AndrusM12-Feb-07 12:49 
QuestionCrystal Report WebService Report to DataSet Pin
dbambirck12-Feb-07 12:36
dbambirck12-Feb-07 12:36 
QuestionCopy value from that table adapter to data grid cell, how? Pin
TrooperIronMan12-Feb-07 12:33
TrooperIronMan12-Feb-07 12:33 
AnswerRe: Copy value from that table adapter to data grid cell, how? Pin
TrooperIronMan12-Feb-07 14:19
TrooperIronMan12-Feb-07 14:19 
GeneralRe: Copy value from that table adapter to data grid cell, how? Pin
TrooperIronMan14-Feb-07 1:38
TrooperIronMan14-Feb-07 1:38 
QuestionHow can I have a Panel in my WindowForm? Pin
Khoramdin12-Feb-07 12:05
Khoramdin12-Feb-07 12:05 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.