| | |
How to pass a xml file taking "uri" as initializer from one class to another class?
Please support our C# advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Feb 2009
Posts: 8
Reputation:
Solved Threads: 0
How to pass a xml file taking "uri" as initializer from one class to another class?
0
#1 Mar 6th, 2009
Hi ,
i have a project in having two classes TreeDisplay(Form.cs) and MytreeNode class in same namespace.
TreeDisplay class contains all the GUI related stuff like Browse button textbox , label,progress bar and TReeView. I want the user to select a XML file through browse button which will be displayed in textbox.The Xml file selected will be displayed in Treeview on winform.
Now i want to separate the GUI part from business logic(where i am creating treenode and adding nodes to tree) thats why i created the MytreeNode class.
i want to pass the string file path from my TreeDisplay class to Mytreenode class.
i want to initialize with file path.
I think something related with Uri "to use a class for xml related logic taking xml file "uri" as initializer."
How to use URI in passing the xml file to MytreeNode class?
Can you help me to do this?
Hope to hear soon.....
Thanks
i have a project in having two classes TreeDisplay(Form.cs) and MytreeNode class in same namespace.
TreeDisplay class contains all the GUI related stuff like Browse button textbox , label,progress bar and TReeView. I want the user to select a XML file through browse button which will be displayed in textbox.The Xml file selected will be displayed in Treeview on winform.
Now i want to separate the GUI part from business logic(where i am creating treenode and adding nodes to tree) thats why i created the MytreeNode class.
i want to pass the string file path from my TreeDisplay class to Mytreenode class.
i want to initialize with file path.
I think something related with Uri "to use a class for xml related logic taking xml file "uri" as initializer."
How to use URI in passing the xml file to MytreeNode class?
Can you help me to do this?
Hope to hear soon.....
Thanks
•
•
Join Date: Aug 2008
Posts: 1,735
Reputation:
Solved Threads: 186
Re: How to pass a xml file taking "uri" as initializer from one class to another class?
0
#2 Mar 6th, 2009
•
•
Join Date: Feb 2009
Posts: 8
Reputation:
Solved Threads: 0
Re: How to pass a xml file taking "uri" as initializer from one class to another class?
0
#3 Mar 6th, 2009
Mytreenode class is like this.....
internal void initiatingTree(string nameofFile)
{
XmlDocument xmlDocument = new XmlDocument();
xmlDocument.Load(nameofFile);
treeView1.Nodes.Clear();
if (xmlDocument.DocumentElement != null)
if (true) treeView1.Nodes.Add(new TreeNode(xmlDocument.DocumentElement.Name));
TreeNode tNodeObj = new TreeNode();
tNodeObj = treeView1.Nodes[0];
if (true)
{
XmlNode xNode = xmlDocument.DocumentElement;
AddNodes(xNode, tNodeObj);
}
treeView1.Nodes[0].Expand();
treeView1.CollapseAll();
}
My treeview is also in error here since i am taking up the treeview GUI from my TreeDisplay class(Form.cs).
How to do this?? Thanks
internal void initiatingTree(string nameofFile)
{
XmlDocument xmlDocument = new XmlDocument();
xmlDocument.Load(nameofFile);
treeView1.Nodes.Clear();
if (xmlDocument.DocumentElement != null)
if (true) treeView1.Nodes.Add(new TreeNode(xmlDocument.DocumentElement.Name));
TreeNode tNodeObj = new TreeNode();
tNodeObj = treeView1.Nodes[0];
if (true)
{
XmlNode xNode = xmlDocument.DocumentElement;
AddNodes(xNode, tNodeObj);
}
treeView1.Nodes[0].Expand();
treeView1.CollapseAll();
}
My treeview is also in error here since i am taking up the treeview GUI from my TreeDisplay class(Form.cs).
How to do this?? Thanks
•
•
Join Date: Aug 2008
Posts: 1,735
Reputation:
Solved Threads: 186
Re: How to pass a xml file taking "uri" as initializer from one class to another class?
0
#4 Mar 6th, 2009
•
•
Join Date: Feb 2009
Posts: 8
Reputation:
Solved Threads: 0
Re: How to pass a xml file taking "uri" as initializer from one class to another class?
0
#5 Mar 6th, 2009
i mean MytreeNodeClass starts like this
public partial class MytreeNodeClass
{
public MytreeNodeClass(string filepath)
{
initiatingTree(filepath);
}
internal void initiatingTree(string nameofFile)
{
//code here is already posted...
}
Now can you tell me how to use uri and where?
Also how to return collection of nodes.
Thanks...
public partial class MytreeNodeClass
{
public MytreeNodeClass(string filepath)
{
initiatingTree(filepath);
}
internal void initiatingTree(string nameofFile)
{
//code here is already posted...
}
Now can you tell me how to use uri and where?
Also how to return collection of nodes.
Thanks...
![]() |
Other Threads in the C# Forum
- Previous Thread: Create library in web
- Next Thread: c# problem solution
| Thread Tools | Search this Thread |
.net access algorithm array backup barchart bitmap box broadcast buttons c# check checkbox client clock combobox control conversion csharp custom database datagrid datagridview dataset datetime degrees developer development draganddrop drawing dynamiccreation encryption enum excel file form format forms function gdi+ hospitalmanagementsystems httpwebrequest image index input install interface java label list listbox mandelbrot math microsystems mouseclick mysql operator password path photoshop picturebox pixelinversion post priviallages. programming property radians regex remoting richtextbox running... serialization server sleep soap socket sql sqlserver stack statistics stream string table temperature text textbox thread time timer update usercontrol validation visualstudio webbrowser windows windowsformsapplication winforms wpf write xml






