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
Vivekh
NA
26
0
Tree View Problem
Jun 29 2010 1:57 AM
Hi all i have written my code to display list of files
private void treeView1_Click(object sender, EventArgs e)
{
string strFiletype;
//path += "fileheader*.txt";
string[] fileEntries = Directory.GetFiles(path, "fileheader*.txt");
foreach (string fileName in fileEntries)
{
strFiletype = fileName.Substring(fileName.IndexOf("fileheader"));
treeView1.Nodes.Add(new TreeNode(strFiletype));
// myTreeNode myNode = (myTreeNode)e.Node;
// MessageBox.Show("Node selected is " + myNode.FilePath);
}
}
But on clicking nodes file are getting appended automatically for multiple times.
And i need another help
My tree view is like this
Root
|-> Child0
|->Child
If i click on Child0 i would like to display the file names under this ..
And whem i am writing this myTreeNode myNode = (myTreeNode)e.Node;
i am getting an error as
Unable to cast object of type 'System.Windows.Forms.TreeNode' to type 'myTreeNode'.
Please can any one modify this and send me
Reply
Answers (
1
)
Treeview
Panel Issue