Click here to Skip to main content
15,920,828 members
Home / Discussions / C#
   

C#

 
GeneralRe: Communicate with USB dongle Pin
Richard Andrew x647-Aug-12 5:24
professionalRichard Andrew x647-Aug-12 5:24 
GeneralRe: Communicate with USB dongle Pin
vikki02868-Aug-12 3:25
vikki02868-Aug-12 3:25 
QuestionHow to connect with USB- Printer through C# .net without windows spooler? Pin
Vikas borkar6-Aug-12 1:13
Vikas borkar6-Aug-12 1:13 
AnswerRe: How to connect with USB- Printer through C# .net without windows spooler? Pin
Wes Aday6-Aug-12 6:48
professionalWes Aday6-Aug-12 6:48 
GeneralRe: How to connect with USB- Printer through C# .net without windows spooler? Pin
Vikas borkar6-Aug-12 19:25
Vikas borkar6-Aug-12 19:25 
QuestionC# and .Net, trying to select a list of classes from name of node in xml file Pin
Perry Nordmann5-Aug-12 4:52
Perry Nordmann5-Aug-12 4:52 
AnswerRe: C# and .Net, trying to select a list of classes from name of node in xml file Pin
Ed Hill _5_5-Aug-12 22:16
Ed Hill _5_5-Aug-12 22:16 
GeneralRe: C# and .Net, trying to select a list of classes from name of node in xml file Pin
Perry Nordmann6-Aug-12 3:27
Perry Nordmann6-Aug-12 3:27 
C#
<blockquote class="FQ">
<div class="FQA">Quote:</div>
XElement doc = XElement.Load(Config.Default.LocXML + Config.Default.NameXML);
            foreach (XElement xmls in doc.Descendants("S"))
            {
                foreach (XElement xmly in xmls.Descendants("Y"))
                {
                    foreach (XElement xmlc in xmly.Descendants("C"))
                    {
                        if (treeView1.SelectedNode.Text == xmls.Attribute("name").Value)
                        {
                            DuHarValgt.Text = "Vennligst velg en klasse til venstre.";
                            ValgtKlasse.Text = "<---------------";
                            DenneEr.Text = "";
                            ÅpenEllerStengt.Text = "";
                            DuMåVente60SekunderFørDuKanÅpneStengeKlassen.Visible = false;
                            button1.Text = "Velg en Klasse";
                            button1.Enabled = false;
                            button1.BackColor = Config.Default.BTNone;

                            if (clear == true)
                            {
                                dataGridView1.Rows.Clear();
                                clear = false;
                            }

                            string Åpent = null;
                            string Låst = null;

                            MySqlCommand cm11 = new MySqlCommand("SELECT `Åpent` FROM " + Config.Default.MySQL_Schema + "." + xmls.Attribute("name").Value + " WHERE `Klasse`='" + xmlc.Attribute("name").Value + "'", cs);
                            using (MySqlDataReader reader11 = cm11.ExecuteReader())
                            { while (reader11.Read()) { if (reader11.GetString(0) == "1") { Åpent = reader11.GetString(0); } else if (reader11.GetString(0) == "0") { Åpent = reader11.GetString(0); } } }
                            if (Åpent == "1") { Åpent = "Ja"; } else { Åpent = "Nei"; }

                            MySqlCommand cm12 = new MySqlCommand("SELECT `Låst` FROM " + Config.Default.MySQL_Schema + "." + xmls.Attribute("name").Value + " WHERE `Klasse`='" + xmlc.Attribute("name").Value + "'", cs);
                            using (MySqlDataReader reader12 = cm12.ExecuteReader())
                            { while (reader12.Read()) { if (reader12.GetString(0) == "1") { Låst = reader12.GetString(0); } else if (reader12.GetString(0) == "0") { Låst = reader12.GetString(0); } } }
                            if (Låst == "1") { Låst = "Ja"; } else { Låst = "Nei"; }

                            dataGridView1.Rows.Add(xmly.Attribute("name").Value, xmlc.Attribute("name").Value, Åpent, Låst);
                        }
                        else if (treeView1.SelectedNode.Text == xmly.Attribute("name").Value)
                        {
                            DuHarValgt.Text = "Vennligst velg en klasse til venstre.";
                            ValgtKlasse.Text = "<---------------";
                            DenneEr.Text = "";
                            ÅpenEllerStengt.Text = "";
                            DuMåVente60SekunderFørDuKanÅpneStengeKlassen.Visible = false;
                            button1.Text = "Velg en Klasse";
                            button1.Enabled = false;
                            button1.BackColor = Config.Default.BTNone;

                            if (clear == true)
                            {
                                dataGridView1.Rows.Clear();
                                clear = false;
                            }

                            string Åpent = null;
                            string Låst = null;

                            MySqlCommand cm11 = new MySqlCommand("SELECT `Åpent` FROM " + Config.Default.MySQL_Schema + "." + xmls.Attribute("name").Value + " WHERE `Klasse`='" + xmlc.Attribute("name").Value + "'", cs);
                            using (MySqlDataReader reader11 = cm11.ExecuteReader())
                            { while (reader11.Read()) { if (reader11.GetString(0) == "1") { Åpent = reader11.GetString(0); } else if (reader11.GetString(0) == "0") { Åpent = reader11.GetString(0); } } }
                            if (Åpent == "1") { Åpent = "Ja"; } else { Åpent = "Nei"; }

                            MySqlCommand cm12 = new MySqlCommand("SELECT `Låst` FROM " + Config.Default.MySQL_Schema + "." + xmls.Attribute("name").Value + " WHERE `Klasse`='" + xmlc.Attribute("name").Value + "'", cs);
                            using (MySqlDataReader reader12 = cm12.ExecuteReader())
                            { while (reader12.Read()) { if (reader12.GetString(0) == "1") { Låst = reader12.GetString(0); } else if (reader12.GetString(0) == "0") { Låst = reader12.GetString(0); } } }
                            if (Låst == "1") { Låst = "Ja"; } else { Låst = "Nei"; }

                            dataGridView1.Rows.Add(xmly.Attribute("name").Value, xmlc.Attribute("name").Value, Åpent, Låst);
                        }
                        else if (treeView1.SelectedNode.Text == xmlc.Attribute("name").Value)
                        {
                            string Åpent = null;
                            string Låst = null;

                            DenneEr.Text = "Denne klassen er:";
                            MySqlCommand cm11 = new MySqlCommand("SELECT `Åpent` FROM " + Config.Default.MySQL_Schema + "." + xmls.Attribute("name").Value + " WHERE `Klasse`='" + xmlc.Attribute("name").Value + "'", cs);
                            using (MySqlDataReader reader11 = cm11.ExecuteReader())
                            { while (reader11.Read()) { if (reader11.GetString(0) == "1") { Åpent = reader11.GetString(0); } else if (reader11.GetString(0) == "0") { Åpent = reader11.GetString(0); } } }
                            if (Åpent == "1") 
                            {
                                ÅpenEllerStengt.Text = "Åpen";
                                button1.Text = "Steng klassen " + treeView1.SelectedNode.Text;
                                button1.Enabled = true;
                                button1.BackColor = Config.Default.BTOpen;
                            }
                            else if (Åpent == "0") 
                            {
                                ÅpenEllerStengt.Text = "Stengt";
                                button1.Text = "Åpne klassen " + treeView1.SelectedNode.Text;
                                button1.Enabled = true;
                                button1.BackColor = Config.Default.BTClosed;
                            }

                            MySqlCommand cm12 = new MySqlCommand("SELECT `Låst` FROM " + Config.Default.MySQL_Schema + "." + xmls.Attribute("name").Value + " WHERE `Klasse`='" + xmlc.Attribute("name").Value + "'", cs);
                            using (MySqlDataReader reader12 = cm12.ExecuteReader())
                            { while (reader12.Read()) { if (reader12.GetString(0) == "1") { Låst = reader12.GetString(0); } else if (reader12.GetString(0) == "0") { Låst = reader12.GetString(0); } } }
                            if (Låst == "1") 
                            { 
                                Låst = "Ja";
                                DuMåVente60SekunderFørDuKanÅpneStengeKlassen.Visible = true;
                                DuMåVente60SekunderFørDuKanÅpneStengeKlassen.Text = "Du må vente ca " + Config.Default.TimerButton + " sekunder før du kan åpne eller stenge klassen.";
                                button1.Text = "Klassen " + treeView1.SelectedNode.Text + " er låst";
                                button1.Enabled = false;
                                button1.BackColor = Config.Default.BTWait;
                            } 
                            else 
                            {
                                Låst = "Nei";
                                DuMåVente60SekunderFørDuKanÅpneStengeKlassen.Visible = false;
                            }

                            DuHarValgt.Text = "Du har valgt klassen:";
                            ValgtKlasse.Text = treeView1.SelectedNode.Text;
                        }
                    }
                }
            }
</blockquote>


Here is the code from my treeview afterselect, thanks Wink | ;)
Perry ^_^

GeneralC# Developer looking for a new project Pin
Liam Cairns Kelly4-Aug-12 15:39
Liam Cairns Kelly4-Aug-12 15:39 
AnswerRe: C# Developer looking for a new project Pin
Wes Aday4-Aug-12 15:43
professionalWes Aday4-Aug-12 15:43 
GeneralRe: C# Developer looking for a new project Pin
Liam Cairns Kelly4-Aug-12 15:45
Liam Cairns Kelly4-Aug-12 15:45 
GeneralRe: C# Developer looking for a new project Pin
Wes Aday4-Aug-12 15:50
professionalWes Aday4-Aug-12 15:50 
GeneralRe: C# Developer looking for a new project Pin
Liam Cairns Kelly4-Aug-12 15:51
Liam Cairns Kelly4-Aug-12 15:51 
GeneralRe: C# Developer looking for a new project Pin
Wes Aday4-Aug-12 15:53
professionalWes Aday4-Aug-12 15:53 
GeneralRe: C# Developer looking for a new project Pin
Mycroft Holmes4-Aug-12 17:47
professionalMycroft Holmes4-Aug-12 17:47 
GeneralRe: C# Developer looking for a new project Pin
Liam Cairns Kelly5-Aug-12 5:13
Liam Cairns Kelly5-Aug-12 5:13 
GeneralRe: C# Developer looking for a new project Pin
jschell5-Aug-12 7:56
jschell5-Aug-12 7:56 
QuestionC# 2010 change linq to sql Pin
dcof4-Aug-12 11:03
dcof4-Aug-12 11:03 
Questiondispose (always?) Pin
thewazz4-Aug-12 7:46
professionalthewazz4-Aug-12 7:46 
GeneralRe: dispose (always?) Pin
PIEBALDconsult4-Aug-12 8:25
mvePIEBALDconsult4-Aug-12 8:25 
GeneralRe: dispose (always?) Pin
OriginalGriff5-Aug-12 22:18
mveOriginalGriff5-Aug-12 22:18 
AnswerRe: dispose (always?) Pin
Ed Hill _5_5-Aug-12 22:12
Ed Hill _5_5-Aug-12 22:12 
AnswerRe: dispose (always?) Pin
OriginalGriff5-Aug-12 22:18
mveOriginalGriff5-Aug-12 22:18 
AnswerRe: dispose (always?) Pin
BobJanova5-Aug-12 23:49
BobJanova5-Aug-12 23:49 
GeneralRe: dispose (always?) Pin
PIEBALDconsult6-Aug-12 3:50
mvePIEBALDconsult6-Aug-12 3:50 

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.