Recently i have been working on a windows application that contains some tree nodes that gets generated by the wizards, and the wizards contains some data that is related to the nodes.Each treenode name gets renamed by the wizard name thus forming a hierarchy of nodes.
Here are the nodes that are being generated dynamically by the wizards on the front:
NODE.png - Google Drive[
^]
These nodes also contains data that are being dumped into database and when right clicked on any of the nodes fetches their properties like this one:WIZARD.png - Google Drive[
^].
I am able to save it using my own file extension but when i try to open that custom extension saved file i only am able to retrieve the node and am not able to view their saved data or the node properties[Like right clicking the node and viewing the saved data from the properties using the context menu strip].Context menustrip doesn't open up for the opened files.
Can anyone help me suggest something that might fetch me all the data stored on the nodes that has been dumped into the database.
Following is the code that i hav used for saving the file:
SaveFileDialog SaveFileDialog1 = new SaveFileDialog();
if (SaveFileDialog1.CheckPathExists == false)
{
SaveFileDialog saveFileDialog1 = new SaveFileDialog();
saveFileDialog1.InitialDirectory = @"C:\";
saveFileDialog1.Title = "Save Vaar Files";
saveFileDialog1.CheckPathExists = true;
saveFileDialog1.DefaultExt = "vaar";
saveFileDialog1.Filter = "vaar file (*.vaar)|*.vaar*";
saveFileDialog1.FilterIndex = 2;
saveFileDialog1.AddExtension = true;
if (saveFileDialog1.ShowDialog() == DialogResult.OK)
{
pathh = saveFileDialog1.FileName.ToString();
saveTree(treeView1, pathh);
}
}
else
{
saveTree(treeView1, pathh);
}
And following is code for opening the saved file:
treeView1.Nodes.Clear();
OpenFileDialog openFileDialog1 = new OpenFileDialog();
openFileDialog1.InitialDirectory = @"C:\";
openFileDialog1.Title = "Browse Text Files";
openFileDialog1.CheckFileExists = true;
openFileDialog1.CheckPathExists = true;
openFileDialog1.DefaultExt = "txt";
openFileDialog1.Filter = "vaar file (*.vaar)|*.vaar|All files (*.*)|*.*";
openFileDialog1.FilterIndex = 2;
openFileDialog1.RestoreDirectory = true;
openFileDialog1.ReadOnlyChecked = true;
openFileDialog1.ShowReadOnly = true;
string pathh = "";
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
pathh = openFileDialog1.FileName.ToString();
loadTree(treeView1, openFileDialog1.FileName.ToString());
}
After opening the saved file i am not able to open the contextmenustrip by right clicking the nodes just like the way i was able to right click on the nodes when creating them and viewing their properties...Anyhelp would be greatly appreciated..:)
What I have tried:
I have tried searching everywhere for this problem and also posted this on various forums but couldnt find any help