this code doesnt remove all child from the node it removes only first child and then exit. why is that so can any one help me .. or how shld i dlete each node one by one
XmlDocument xsd=new XmlDocument();
XmlElement elem= xsd.DocumentElement;
XmlNodeList lis= elem.ChildNodes;
foreach(XmlNode node in lis)
the xml document is
</xml version="1.0" encoding="utf-8"?>
A foreach statement should not be used to change the content of a collection, so replacing it with a for-loop should solve the problem. However, the easiest way would be calling RemoveAll.
"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
1 - buy the book
2 - steal the book from a website full of illegal e-books.
I recommend way# 1.
Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
I have an requirement to read the data from excel sheets. Excel work book contains 5 sheets. Each day I have to read 5 different sheets. How should I code so as to read a particular sheet on each day(for eg: Monday - Sheet1; Tuesday - Sheet 2 like that). And also I need only to read the values from one colum, say column C.
Also, there are chances the sheets gets updated by the users often. So can I read the data eventhough the file is open?
Any help in this regard will be great. Please provide the code, if possible.
Thank you for your efforts and timings. I can use this component in one of my other application.
But, in this application, the no.of rows may exceed 150. It will be upto 15000 max and also the sheets are likely to increase by one or two. So how should I handle in such a case? Is there anyway like Sheets.Find and giving the worksheet name?
I'm developing a client for a web service which requires SSL authentication(via https).
Normally certificates are installed manually by the the user. But I am assuming that many different users with many different certificates will use the same computer and I don't want to have all the certificates installed at a given time for security reasons.
What I want to do is to implement a mechanism so that the certificate used for authentication can be installed before the web method call and uninstalled afterwards. So I've written a couple methods to do this.
The problem is that the InstallCert method does not install the certificate, but the UninstallCert methods does what's supposed to do, assuming that the certificate in subject has previously been installed in the store(for now I do that manually).
I found a way to make it work but I still don't understand why it didn't work in the first place. It's totally unlikely to be a bug, but it seems that way.
So, instead of adding the single certificate to the certificate store, I add a collection of certificates(which only holds one certificate) using the AddRange() method of the X509Store object. And it works.
If you are really really bored and have nothing else better to do you might as well try it. It's just a few lines of code.