I'm trying to use a TreeNode (System.Windows.Forms.TreeNode) as a user setting for one of my applications.
if(treeView.SelectedNode != null)
{
Properties.Settings.Default.SelectedTreeNode = treeView.SelectedNode;
Properties.Settings.Default.Save();
}
Then on Application Load I'm trying to use that Setting
if (Properties.Settings.Default.SelectedTreeNode != null)
treeView.SelectedNode= Properties.Settings.Default.SelectedTreeNode;
but no matter what I do, Properties.Settings.Default.SelectedTreeNode is always null when I reload the application.
I've also tried just using an Object and casting to a TreeNode, but that doesn't work either.
I really don't want to use string Settings for this, and want to stick with TreeNode if possible, but a serialized TreeNode would work if there is no way to use a TreeNode. I'm just not too familiar with Serialization.