Click here to Skip to main content
15,887,027 members
Home / Discussions / C#
   

C#

 
AnswerRe: Help,How to Convert the Array,Collection,DataTable Or DataSet to Xml File? Pin
Richard MacCutchan3-Dec-12 21:41
mveRichard MacCutchan3-Dec-12 21:41 
QuestionAccessing Form Elements From Different Files Pin
C-P-User-33-Dec-12 14:54
C-P-User-33-Dec-12 14:54 
AnswerRe: Accessing Form Elements From Different Files Pin
Mycroft Holmes3-Dec-12 16:14
professionalMycroft Holmes3-Dec-12 16:14 
AnswerRe: Accessing Form Elements From Different Files Pin
PIEBALDconsult3-Dec-12 16:16
mvePIEBALDconsult3-Dec-12 16:16 
AnswerRe: Accessing Form Elements From Different Files Pin
Gerry Schmitz3-Dec-12 21:02
mveGerry Schmitz3-Dec-12 21:02 
GeneralRe: Accessing Form Elements From Different Files Pin
C-P-User-34-Dec-12 3:24
C-P-User-34-Dec-12 3:24 
GeneralRe: Accessing Form Elements From Different Files Pin
Gerry Schmitz4-Dec-12 10:35
mveGerry Schmitz4-Dec-12 10:35 
QuestionPassing object between event handlers? Pin
Member 96474613-Dec-12 13:30
Member 96474613-Dec-12 13:30 
Hi all,

im new to C# (coming from matlab), and so theres a lot to explore for me (the whole OOP thing Wink | ;) ). Currently I write a simple program which deserializes a xml file (on a menu click) and shows the xml structure in a treeview.

My Problem:
When clicking on an element of the treeview, i want to show the content of the chosen xml field in a datagrid. This means I have to make the deserialized xml (which is an object) avaialable for the treeView1_AfterSelect. Maybe someone has a hint for me? I already searched for a solutions which fits this problem Smile | :) . Maybe its to obvious ^^?

Here's some code (im very new to OOP so dont laugh Big Grin | :-D ).

C#
...

        private void loadObjectsToolStripMenuItem_Click(object sender, EventArgs e)
        {
// get xml File
            string FilePath = string.Empty;

            OpenFileDialog openFileDialog1 = new OpenFileDialog();
            openFileDialog1.Filter = "xml files (*.xml)|*.xml| All files (*.*)|*.*";
            openFileDialog1.InitialDirectory = System.IO.Path.Combine(System.IO.Path.GetDirectoryName(Application.ExecutablePath), @"");
            if (openFileDialog1.ShowDialog() == DialogResult.OK)
                FilePath = openFileDialog1.FileName;

// deserialize xml file, so i have an object
            xmlDataThings xmlData= (xmlDataThings )xmlReadWrite.DeSerializeFromXML(FilePath, typeof(xmlDataThings ));


//create treeview and add nodes (works fine)
            TreeNode tNode = new TreeNode(openFileDialog1.SafeFileName);

            if (treeViewObjects.Nodes.ContainsKey(openFileDialog1.SafeFileName))
                return;
                
            tNode.Name = openFileDialog1.SafeFileName;

            treeViewObjects.Nodes.Add(tNode);

            tNode = treeViewObjects.Nodes[treeViewObjects.Nodes.Count-1];
            
            AddNode(xmlData, tNode);

            treeViewObjects.ExpandAll();

        }

// !!!!!!!! Want to have the xmlData in here HELP :D !!!!!!
private void treeViewObjects_AfterSelect(object sender, TreeViewEventArgs e)
{
            if (treeViewObjects.SelectedNode.Level == 2)
            {

                // please xmlData, come in here RIGHT HERE!!!!!!

            }
...
}



Would be very nice if someone has a hint for me.
AnswerRe: Passing object between event handlers? Pin
SledgeHammer013-Dec-12 13:52
SledgeHammer013-Dec-12 13:52 
GeneralRe: Passing object between event handlers? Pin
Member 96474614-Dec-12 6:33
Member 96474614-Dec-12 6:33 
GeneralRe: Passing object between event handlers? Pin
SledgeHammer014-Dec-12 6:39
SledgeHammer014-Dec-12 6:39 
GeneralRe: Passing object between event handlers? Pin
Member 96474614-Dec-12 7:37
Member 96474614-Dec-12 7:37 
GeneralRe: Passing object between event handlers? Pin
SledgeHammer014-Dec-12 8:10
SledgeHammer014-Dec-12 8:10 
Questionusing c\c++ dll from winrt (c++) Pin
bondarenkod3-Dec-12 11:15
bondarenkod3-Dec-12 11:15 
AnswerRe: using c\c++ dll from winrt (c++) Pin
Dave Kreskowiak3-Dec-12 12:29
mveDave Kreskowiak3-Dec-12 12:29 
Question256 points at 250 Hz Pin
C-P-User-33-Dec-12 10:50
C-P-User-33-Dec-12 10:50 
AnswerRe: 256 points at 250 Hz Pin
SledgeHammer013-Dec-12 11:50
SledgeHammer013-Dec-12 11:50 
GeneralRe: 256 points at 250 Hz Pin
C-P-User-33-Dec-12 13:20
C-P-User-33-Dec-12 13:20 
GeneralRe: 256 points at 250 Hz Pin
SledgeHammer013-Dec-12 13:50
SledgeHammer013-Dec-12 13:50 
QuestionWhy static classes? Pin
mjackson113-Dec-12 7:54
mjackson113-Dec-12 7:54 
AnswerRe: Why static classes? Pin
PIEBALDconsult3-Dec-12 8:49
mvePIEBALDconsult3-Dec-12 8:49 
AnswerRe: Why static classes? Pin
Clifford Nelson3-Dec-12 10:23
Clifford Nelson3-Dec-12 10:23 
AnswerRe: Why static classes? Pin
Eddy Vluggen3-Dec-12 13:35
professionalEddy Vluggen3-Dec-12 13:35 
GeneralRe: Why static classes? Pin
PIEBALDconsult4-Dec-12 3:37
mvePIEBALDconsult4-Dec-12 3:37 
GeneralRe: Why static classes? Pin
Eddy Vluggen4-Dec-12 4:21
professionalEddy Vluggen4-Dec-12 4:21 

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.