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

C#

 
GeneralRe: tracking mouse position Pin
Nish Nishant11-Jul-09 3:15
sitebuilderNish Nishant11-Jul-09 3:15 
Questionthread not started Pin
Vivek Vijayan10-Jul-09 20:03
Vivek Vijayan10-Jul-09 20:03 
AnswerRe: thread not started Pin
dan!sh 10-Jul-09 20:24
professional dan!sh 10-Jul-09 20:24 
QuestionAAARGGHH - need example of building a multi-column list in memory unknown # of rows Pin
Robert Bone10-Jul-09 19:40
Robert Bone10-Jul-09 19:40 
AnswerRe: AAARGGHH - need example of building a multi-column list in memory unknown # of rows Pin
dan!sh 10-Jul-09 20:37
professional dan!sh 10-Jul-09 20:37 
Question<> command ? Pin
Ali Jahan10-Jul-09 19:20
Ali Jahan10-Jul-09 19:20 
AnswerRe: <> command ? [modified] Pin
OriginalGriff10-Jul-09 21:51
mveOriginalGriff10-Jul-09 21:51 
QuestionLINQ, XML to tree class Pin
VickyC#10-Jul-09 19:09
VickyC#10-Jul-09 19:09 
I have the following XML:

<?xml version="1.0" encoding="utf-8" ?>
<string xmlns="http://none.none.none/webservices">
<TREENODES xmlns:sql="urn:schemas-microsoft-com:xml-sql">
   <TREENODE code="1" text="None" >
      <TREENODE code="2" text="America" >
         <TREENODE code="16128" text="AUTOS">
            <TREENODE code="ATO" text="ATO" />
            <TREENODE code="ATO" text="ATO" />
         </TREENODE>
         </TREENODE>
      </TREENODE>
   <TREENODE code="11" text="None" >
      <TREENODE code="21" text="America" >
         <TREENODE code="3" text="AUTOS">
            <TREENODE code="ATO44" text="ATO5" />
         </TREENODE>
      </TREENODE>
   </TREENODE>
</TREENODES>
</string>

And this code to read the xml into class Hierarchy.

            void client_ReadCompleted(object sender, ReadCompletedEventArgs e) {
                  if (e.Error == null) {
                        string s = e.Result.ToString();

                        XDocument document = XDocument.Parse(s);
                        var retVal = (from treeNode in document.Descendants("TREENODE")
                                             select new Hierarchy() {
                                                   Code = treeNode.Attribute("code").Value,
                                                   Text = treeNode.Attribute("text").Value,
                                             }).FirstOrDefault();
                        retVal.Hierarchies = GetHierarchy((from treeNode
                                                                                 in document.Descendants("TREENODES")
                                                                              select treeNode).FirstOrDefault());
                        Hierarchies = retVal.Hierarchies;
                  }
            }
            public static List<Hierarchy> GetHierarchy(XContainer root) {
                  List<Hierarchy> retVal = new List<Hierarchy>();
                  var children = from treenode in root.Descendants("TREENODE")
                                       select treenode;

                  foreach (var treenode in children) {
                        Hierarchy node = new Hierarchy();
                        node.Code = treenode.Attribute("code").Value;
                        node.Text = treenode.Attribute("text").Value;
                        node.Hierarchies = GetHierarchy(treenode);
                        retVal.Add(node);
                  }
                  return retVal;
            }

      public class Hierarchy {
            public string Code { get; set; }
            public string Text { get; set; }
            public List<Hierarchy> Hierarchies { get; set; }
            public Hierarchy() {
                  Hierarchies = new List<Hierarchy>();
            }
      }

However my construction/population of the class is not the same as the XML. I can not see the error.
AnswerRe: LINQ, XML to tree class Pin
VickyC#10-Jul-09 21:21
VickyC#10-Jul-09 21:21 
QuestionHow to globally suppress mouse click Pin
GeeBru10-Jul-09 12:14
GeeBru10-Jul-09 12:14 
AnswerRe: How to globally suppress mouse click Pin
Not Active10-Jul-09 13:08
mentorNot Active10-Jul-09 13:08 
GeneralRe: How to globally suppress mouse click Pin
GeeBru10-Jul-09 13:13
GeeBru10-Jul-09 13:13 
GeneralRe: How to globally suppress mouse click Pin
Not Active10-Jul-09 13:20
mentorNot Active10-Jul-09 13:20 
GeneralRe: How to globally suppress mouse click Pin
GeeBru10-Jul-09 13:23
GeeBru10-Jul-09 13:23 
Questionworking with dates and database Pin
elidotnet10-Jul-09 12:00
elidotnet10-Jul-09 12:00 
AnswerRe: working with dates and database Pin
Not Active10-Jul-09 13:18
mentorNot Active10-Jul-09 13:18 
AnswerRe: working with dates and database Pin
Henry Minute10-Jul-09 13:23
Henry Minute10-Jul-09 13:23 
QuestionDifferentiate Restart vs Shut Down, StandBy vs Hibernate Pin
olograph10-Jul-09 11:57
olograph10-Jul-09 11:57 
AnswerRe: Differentiate Restart vs Shut Down, StandBy vs Hibernate Pin
OriginalGriff10-Jul-09 21:57
mveOriginalGriff10-Jul-09 21:57 
QuestionNeed suggestions on datagrid/dataview Pin
babbelfisken10-Jul-09 11:26
babbelfisken10-Jul-09 11:26 
AnswerRe: Need suggestions on datagrid/dataview Pin
DaveyM6910-Jul-09 11:33
professionalDaveyM6910-Jul-09 11:33 
QuestionActive Directory... C#... How do I get the users windows login? Help please. [modified] Pin
JollyMansArt10-Jul-09 10:12
JollyMansArt10-Jul-09 10:12 
QuestionRe: Active Directory... C#... How do I get the users windows login? Help please. Pin
JollyMansArt10-Jul-09 12:13
JollyMansArt10-Jul-09 12:13 
AnswerFigured it out... Pin
JollyMansArt10-Jul-09 12:18
JollyMansArt10-Jul-09 12:18 
Questiontabbed forms with identical content. Pin
avDallas10-Jul-09 9:18
avDallas10-Jul-09 9:18 

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.