TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Rach Singh
NA
17
0
How to use a class for xml related logic taking xml file "uri" as initializer.
Mar 5 2009 5:27 AM
Hi ,
i have a project in which i created 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 am passing the treeview and the string filename from the FileOpenDialogue in Browse button.
i want to pass a Xml file name from one class to another class in same namespace using URI.i want to
initialize with file path
. i have passed the treeview object from GUI to my backhand class MytreeNode class.
But how to initialize with fie path? here is a part of code.
public class MytreeNodeClass
{
internal void initiatingTree(string nameofFile,TreeView treeView1)
{
try
{
XmlDocument xmlDocument = new XmlDocument();
xmlDocument.Load(nameofFile);
treeView1.Nodes.Clear();
if (xmlDocument.DocumentElement != null)
if (true) treeView1.Nodes.Add(new TreeNode(xmlDocument.DocumentElement.Name));
Help me in putting up the right part of code at right place.
Thanks
Reply
Answers (
1
)
inheritance in c#
Tabular data in .txt file