Click here to Skip to main content
15,897,518 members
Home / Discussions / C#
   

C#

 
QuestionBest way of remembering the history of treeview and other control also across the application in desktop application Pin
Member 101628907-Mar-19 5:23
Member 101628907-Mar-19 5:23 
AnswerRe: Best way of remembering the history of treeview and other control also across the application in desktop application Pin
Richard MacCutchan7-Mar-19 5:32
mveRichard MacCutchan7-Mar-19 5:32 
AnswerRe: Best way of remembering the history of treeview and other control also across the application in desktop application Pin
Eddy Vluggen7-Mar-19 11:35
professionalEddy Vluggen7-Mar-19 11:35 
AnswerRe: Best way of remembering the history of treeview and other control also across the application in desktop application Pin
BillWoodruff8-Mar-19 17:11
professionalBillWoodruff8-Mar-19 17:11 
GeneralRe: Best way of remembering the history of treeview and other control also across the application in desktop application Pin
Member 1016289011-Mar-19 21:43
Member 1016289011-Mar-19 21:43 
GeneralRe: Best way of remembering the history of treeview and other control also across the application in desktop application Pin
BillWoodruff11-Mar-19 21:50
professionalBillWoodruff11-Mar-19 21:50 
GeneralRe: Best way of remembering the history of treeview and other control also across the application in desktop application Pin
Member 1016289013-Mar-19 5:59
Member 1016289013-Mar-19 5:59 
GeneralRe: Best way of remembering the history of treeview and other control also across the application in desktop application Pin
BillWoodruff13-Mar-19 6:44
professionalBillWoodruff13-Mar-19 6:44 
First, ... and, I may be misinterpreting you here ... never put a Form inside another Form; use Panels.

What you describe does not seem that complex; I'd create some data-structure to hold the state of the panel to treenode relations: I'd use a Class that I could serialize, maybe something like:
using System.Collections.Generic;
using System.Runtime.Serialization;
using System.Windows.Forms;

namespace ?????????????
{
    [DataContract]
    public static class PanelToNode
    {
        [DataMember]
        private static Dictionary<string, string> PanelNameToTreeNodeKey;

        //static ctor
        static PanelToNode()
        {
            PanelNameToTreeNodeKey = new Dictionary<string, string>();
        }

        public static TreeNode GetCurrentNode(Panel pnl)
        {
            // => Treenode
        }

        public static Panel GetCurrentNode(TreeNode node)
        {
            // => Panel
        }

        public static void Serialize(string filepath)
        {

        }

        public static void DeSerialize(string filepath)
        {

        }'

    }
}
Do study the relation between a TreeNode's 'Text and 'Name properties: setting the 'Text when you create a TreeNode does not set the 'Name. Why set/use the 'Name: because to find a TreeNode recursively using 'Find:

TreeNode[] matches = treeView1.Nodes.Find("someNode", searchAllChildren: true);

You must use the 'Name property ... which is really the 'Key property. Note what using 'Find returns: an array of TreeNodes ... think about that: it means many nodes can have the same 'Name.

There are many other ways you could approach coding this. And, now, you get started researching and experimenting, and come back with specific questions and code.
«Where is the Life we have lost in living? Where is the wisdom we have lost in knowledge? Where is the knowledge we have lost in information?» T. S. Elliot

QuestionCan classes be nested Pin
Brian_TheLion6-Mar-19 17:26
Brian_TheLion6-Mar-19 17:26 
AnswerRe: Can classes be nested Pin
BillWoodruff6-Mar-19 19:37
professionalBillWoodruff6-Mar-19 19:37 
GeneralRe: Can classes be nested Pin
Ralf Meier7-Mar-19 0:08
mveRalf Meier7-Mar-19 0:08 
GeneralRe: Can classes be nested Pin
Brian_TheLion7-Mar-19 10:53
Brian_TheLion7-Mar-19 10:53 
GeneralRe: Can classes be nested Pin
Dave Kreskowiak7-Mar-19 11:50
mveDave Kreskowiak7-Mar-19 11:50 
GeneralRe: Can classes be nested Pin
BillWoodruff8-Mar-19 17:03
professionalBillWoodruff8-Mar-19 17:03 
GeneralRe: Can classes be nested Pin
Brian_TheLion9-Mar-19 18:50
Brian_TheLion9-Mar-19 18:50 
AnswerRe: Can classes be nested Pin
Richard Deeming6-Mar-19 21:46
mveRichard Deeming6-Mar-19 21:46 
QuestionCRTP in c#/.NET? Pin
pr1mem0ver6-Mar-19 13:19
pr1mem0ver6-Mar-19 13:19 
AnswerRe: CRTP in c#/.NET? Pin
BillWoodruff6-Mar-19 21:15
professionalBillWoodruff6-Mar-19 21:15 
GeneralRe: CRTP in c#/.NET? Pin
pr1mem0ver7-Mar-19 5:09
pr1mem0ver7-Mar-19 5:09 
GeneralRe: CRTP in c#/.NET? Pin
BillWoodruff7-Mar-19 7:00
professionalBillWoodruff7-Mar-19 7:00 
AnswerRe: CRTP in c#/.NET? Pin
Gerry Schmitz7-Mar-19 7:26
mveGerry Schmitz7-Mar-19 7:26 
GeneralRe: CRTP in c#/.NET? Pin
BillWoodruff8-Mar-19 17:16
professionalBillWoodruff8-Mar-19 17:16 
GeneralRe: CRTP in c#/.NET? Pin
pr1mem0ver11-Mar-19 16:55
pr1mem0ver11-Mar-19 16:55 
QuestionOnly Numeric Textbox ( Back Space is working ) Pin
Bayram Demirci6-Mar-19 1:31
Bayram Demirci6-Mar-19 1:31 
AnswerRe: Only numeric ( Back Space is working also ) Pin
OriginalGriff6-Mar-19 1:58
mveOriginalGriff6-Mar-19 1:58 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.