<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://www.dotnetzone.gr:443/cs/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Πρώτα Βήματα - Desktop Applications</title><link>https://www.dotnetzone.gr:443/cs/forums/80/ShowForum.aspx</link><description>Θέματα για όσους φτιάχνουν τα πρώτα τους Desktop Applications σε .NET Framework</description><dc:language>el</dc:language><generator>CommunityServer 2.1 SP3 (Build: 20423.1)</generator><item><title>Απ: checklistbox &amp; database</title><link>https://www.dotnetzone.gr:443/cs/forums/thread/51394.aspx</link><pubDate>Sat, 06 Jun 2009 00:23:58 GMT</pubDate><guid isPermaLink="false">2622095e-976c-431a-859e-16783ec7ecd7:51394</guid><dc:creator>miket969</dc:creator><slash:comments>0</slash:comments><comments>https://www.dotnetzone.gr:443/cs/forums/thread/51394.aspx</comments><wfw:commentRss>https://www.dotnetzone.gr:443/cs/forums/commentrss.aspx?SectionID=80&amp;PostID=51394</wfw:commentRss><description>Δε σου τσακάρονται τα active names ή δε γίνεται populate το CheckedlistBox καν; Αν είναι το πρώτο δοκίμασε να διαβάσεις την act στήλη σαν string και ανάλογα το string να κάνεις setItemChecked... αν συμβαίνει και το δεύτερο, δοκίμασε να κάνεις το populate και το checking σε δύο ξεχωριστά loops...&lt;br&gt;&lt;br&gt;(και πες μου αν το πέτυχα&amp;nbsp;&amp;nbsp; &lt;img src="http://www.dotnetzone.gr/cs/emoticons/emotion-4.gif" alt="Stick out tongue" /&gt;&amp;nbsp; )&lt;br&gt;</description></item><item><title>checklistbox &amp; database</title><link>https://www.dotnetzone.gr:443/cs/forums/thread/50281.aspx</link><pubDate>Tue, 28 Apr 2009 02:58:58 GMT</pubDate><guid isPermaLink="false">2622095e-976c-431a-859e-16783ec7ecd7:50281</guid><dc:creator>paradisesoul</dc:creator><slash:comments>0</slash:comments><comments>https://www.dotnetzone.gr:443/cs/forums/thread/50281.aspx</comments><wfw:commentRss>https://www.dotnetzone.gr:443/cs/forums/commentrss.aspx?SectionID=80&amp;PostID=50281</wfw:commentRss><description>Καλησπέρα,&lt;br&gt;&lt;br&gt;&amp;nbsp;Λοιπόν, έχω ένα checklistbox όπου δένω πάνω του μια στήλη από ένα πίνακα MySQL. Έχω επίσης μια στήλη με το εάν κάποιος είναι ενεργός ή όχι. Θέλω να τσεκάρεται η γραμμή του checklistbox ανάλογα της κατάστασης της κάθε εγγραφής. Παραθέτω τον κώδικα ως έχει. Κάτι μου ξεφεύγει... &lt;br&gt;&lt;pre&gt;&lt;span style="color:Black;background-color:transparent;font-family:Courier New;font-size:11px;font-weight:normal;"&gt;&lt;span style="color:Green;background-color:transparent;font-family:Courier New;font-size:11px;font-weight:normal;"&gt;//connection string&lt;/span&gt;
            &lt;span style="color:Blue;background-color:transparent;font-family:Courier New;font-size:11px;font-weight:normal;"&gt;string&lt;/span&gt; MyConn &lt;span style="color:Red;background-color:transparent;font-family:Courier New;font-size:11px;font-weight:normal;"&gt;=&lt;/span&gt; &lt;span style="font-family:Courier New;font-size:11px;font-weight:normal;"&gt;@"
            Server=localhost;
            Database=mytest;
            Uid=root;
            Pwd=54321;
            "&lt;/span&gt;;

            MySqlConnection aConnection &lt;span style="color:Red;background-color:transparent;font-family:Courier New;font-size:11px;font-weight:normal;"&gt;=&lt;/span&gt; &lt;span style="color:Blue;background-color:transparent;font-family:Courier New;font-size:11px;font-weight:normal;"&gt;new&lt;/span&gt; MySqlConnection(MyConn);
            MySqlCommand aCommand &lt;span style="color:Red;background-color:transparent;font-family:Courier New;font-size:11px;font-weight:normal;"&gt;=&lt;/span&gt; &lt;span style="color:Blue;background-color:transparent;font-family:Courier New;font-size:11px;font-weight:normal;"&gt;new&lt;/span&gt; MySqlCommand(&lt;span style="font-family:Courier New;font-size:11px;font-weight:normal;"&gt;"SELECT * FROM cust"&lt;/span&gt;, aConnection);
           
            aConnection.Open();
           MySqlDataReader aReader &lt;span style="color:Red;background-color:transparent;font-family:Courier New;font-size:11px;font-weight:normal;"&gt;=&lt;/span&gt; aCommand.ExecuteReader();
           
           
      
            checkedListBox1.Items.Clear();

            
            &lt;span style="color:Blue;background-color:transparent;font-family:Courier New;font-size:11px;font-weight:normal;"&gt;while&lt;/span&gt; (aReader.Read())
            {
                checkedListBox1.Items.Add(aReader[&lt;span style="font-family:Courier New;font-size:11px;font-weight:normal;"&gt;"name"&lt;/span&gt;].ToString());
                
                &lt;span style="color:Blue;background-color:transparent;font-family:Courier New;font-size:11px;font-weight:normal;"&gt;for&lt;/span&gt; (&lt;span style="color:Blue;background-color:transparent;font-family:Courier New;font-size:11px;font-weight:normal;"&gt;int&lt;/span&gt; i &lt;span style="color:Red;background-color:transparent;font-family:Courier New;font-size:11px;font-weight:normal;"&gt;=&lt;/span&gt; 0; i &amp;lt; checkedListBox1.Items.Count; i++)
                {  
                    &lt;span style="color:Blue;background-color:transparent;font-family:Courier New;font-size:11px;font-weight:normal;"&gt;if&lt;/span&gt;((&lt;span style="color:Blue;background-color:transparent;font-family:Courier New;font-size:11px;font-weight:normal;"&gt;bool&lt;/span&gt;)aReader[&lt;span style="font-family:Courier New;font-size:11px;font-weight:normal;"&gt;"act"&lt;/span&gt;])
                        checkedListBox1.SetItemChecked(i,(&lt;span style="color:Blue;background-color:transparent;font-family:Courier New;font-size:11px;font-weight:normal;"&gt;bool&lt;/span&gt;)aReader[&lt;span style="font-family:Courier New;font-size:11px;font-weight:normal;"&gt;"act"&lt;/span&gt;]);
                   
                }
                   
              
            }
                aReader.Close();
                aConnection.Close();
            }&lt;/span&gt;&lt;/pre&gt; &lt;br&gt;</description></item></channel></rss>