Yazılım.
CevapSitesi.com Beta!
Çözüm Noktası
Bu siteyi Facebook, Twitter, Google+ veya e-posta ile paylaşın.
| Sorular | Makaleler | Üyeler | Etiketler  | İletişim
Soru sormak ya da cevap vermek için;
giriş yapın veya üye olun.

Sosyal medya hesaplarınızla da giriş yapabilirsiniz.

Cevap Geçmişi

«« Soruya geri dön
03.02.20 20:53
Devexpress kullandığım için çalışmıyor galiba. Şu şekilde değiştirmiştim. ... private void cmb1_SelectedIndexChanged ( object sender , EventArgs e ) { for ( int i = 0 ; i &lt; this . Controls . Count ; i ++) { Control ctrl1 = this . Controls [ i ]; if ( ctrl1 is ComboBoxEdit &amp;&amp; ctrl1 . Name . StartsWith ( "cmb" )) { String tbName = "text" + ctrl1 . Name . Replace ( "cmb" , "" ); Control ctrl2 = this . Controls . Find ( tbName , true ). FirstOrDefault (); if ( ctrl2 != null &amp;&amp; ctrl2 is TextEdit ) { (( TextEdit ) ctrl2 ). Enabled = (( ComboBoxEdit ) ctrl1 ). SelectedIndex &gt; - 1 ; } } } } <li value="1" class="L0" style="color: silver;"><span class="kwd" style="color: rgb(0, 0, 136);">private</span><span class="pln" style="color: rgb(0, 0, 0);"> </span><span class="kwd" style="color: rgb(0, 0, 136);">void</span><span class="pln" style="color: rgb(0, 0, 0);"> cmb1_SelectedIndexChanged</span><span class="pun" style="color: rgb(102, 102, 0);">(</span><span class="kwd" style="color: rgb(0, 0, 136);">object</span><span class="pln" style="color: rgb(0, 0, 0);"> sender</span><span class="pun" style="color: rgb(102, 102, 0);">,</span><span class="pln" style="color: rgb(0, 0, 0);"> </span><span class="typ" style="color: rgb(102, 0, 102);">EventArgs</span><span class="pln" style="color: rgb(0, 0, 0);"> e</span><span class="pun" style="color: rgb(102, 102, 0);">)</span></li><li class="L1" style="color: silver; background: rgb(250, 250, 250);"><span class="pln" style="color: rgb(0, 0, 0);"> </span><span class="pun" style="color: rgb(102, 102, 0);">{</span></li><li class="L2" style="color: silver;"><span class="pln" style="color: rgb(0, 0, 0);"> </span><span class="kwd" style="color: rgb(0, 0, 136);">for</span><span class="pln" style="color: rgb(0, 0, 0);"> </span><span class="pun" style="color: rgb(102, 102, 0);">(</span><span class="kwd" style="color: rgb(0, 0, 136);">int</span><span class="pln" style="color: rgb(0, 0, 0);"> i </span><span class="pun" style="color: rgb(102, 102, 0);">=</span><span class="pln" style="color: rgb(0, 0, 0);"> </span><span class="lit" style="color: rgb(0, 102, 102);">0</span><span class="pun" style="color: rgb(102, 102, 0);">;</span><span class="pln" style="color: rgb(0, 0, 0);"> i </span><span class="pun" style="color: rgb(102, 102, 0);">&lt;</span><span class="pln" style="color: rgb(0, 0, 0);"> </span><span class="kwd" style="color: rgb(0, 0, 136);">this</span><span class="pun" style="color: rgb(102, 102, 0);">.</span><span class="typ" style="color: rgb(102, 0, 102);">Controls</span><span class="pun" style="color: rgb(102, 102, 0);">.</span><span class="typ" style="color: rgb(102, 0, 102);">Count</span><span class="pun" style="color: rgb(102, 102, 0);">;</span><span class="pln" style="color: rgb(0, 0, 0);"> i</span><span class="pun" style="color: rgb(102, 102, 0);">++)</span></li><li class="L3" style="color: silver; background: rgb(250, 250, 250);"><span class="pln" style="color: rgb(0, 0, 0);"> </span><span class="pun" style="color: rgb(102, 102, 0);">{</span></li><li class="L4" style="color: silver;"><span class="pln" style="color: rgb(0, 0, 0);"> </span><span class="typ" style="color: rgb(102, 0, 102);">Control</span><span class="pln" style="color: rgb(0, 0, 0);"> ctrl1 </span><span class="pun" style="color: rgb(102, 102, 0);">=</span><span class="pln" style="color: rgb(0, 0, 0);"> </span><span class="kwd" style="color: rgb(0, 0, 136);">this</span><span class="pun" style="color: rgb(102, 102, 0);">.</span><span class="typ" style="color: rgb(102, 0, 102);">Controls</span><span class="pun" style="color: rgb(102, 102, 0);">[</span><span class="pln" style="color: rgb(0, 0, 0);">i</span><span class="pun" style="color: rgb(102, 102, 0);">];</span></li><li class="L5" style="color: silver; background: rgb(250, 250, 250);"><span class="pln" style="color: rgb(0, 0, 0);"> </span><span class="kwd" style="color: rgb(0, 0, 136);">if</span><span class="pln" style="color: rgb(0, 0, 0);"> </span><span class="pun" style="color: rgb(102, 102, 0);">(</span><span class="pln" style="color: rgb(0, 0, 0);">ctrl1 </span><span class="kwd" style="color: rgb(0, 0, 136);">is</span><span class="pln" style="color: rgb(0, 0, 0);"> </span><span class="typ" style="color: rgb(102, 0, 102);">ComboBoxEdit</span><span class="pln" style="color: rgb(0, 0, 0);"> </span><span class="pun" style="color: rgb(102, 102, 0);">&amp;&amp;</span><span class="pln" style="color: rgb(0, 0, 0);"> ctrl1</span><span class="pun" style="color: rgb(102, 102, 0);">.</span><span class="typ" style="color: rgb(102, 0, 102);">Name</span><span class="pun" style="color: rgb(102, 102, 0);">.</span><span class="typ" style="color: rgb(102, 0, 102);">StartsWith</span><span class="pun" style="color: rgb(102, 102, 0);">(</span><span class="str" style="color: rgb(0, 136, 0);">"cmb"</span><span class="pun" style="color: rgb(102, 102, 0);">))</span></li><li class="L6" style="color: silver;"><span class="pln" style="color: rgb(0, 0, 0);"> </span><span class="pun" style="color: rgb(102, 102, 0);">{</span></li><li class="L7" style="color: silver; background: rgb(250, 250, 250);"><span class="pln" style="color: rgb(0, 0, 0);"> </span><span class="typ" style="color: rgb(102, 0, 102);">String</span><span class="pln" style="color: rgb(0, 0, 0);"> tbName </span><span class="pun" style="color: rgb(102, 102, 0);">=</span><span class="pln" style="color: rgb(0, 0, 0);"> </span><span class="str" style="color: rgb(0, 136, 0);">"text"</span><span class="pln" style="color: rgb(0, 0, 0);"> </span><span class="pun" style="color: rgb(102, 102, 0);">+</span><span class="pln" style="color: rgb(0, 0, 0);"> ctrl1</span><span class="pun" style="color: rgb(102, 102, 0);">.</span><span class="typ" style="color: rgb(102, 0, 102);">Name</span><span class="pun" style="color: rgb(102, 102, 0);">.</span><span class="typ" style="color: rgb(102, 0, 102);">Replace</span><span class="pun" style="color: rgb(102, 102, 0);">(</span><span class="str" style="color: rgb(0, 136, 0);">"cmb"</span><span class="pun" style="color: rgb(102, 102, 0);">,</span><span class="pln" style="color: rgb(0, 0, 0);"> </span><span class="str" style="color: rgb(0, 136, 0);">""</span><span class="pun" style="color: rgb(102, 102, 0);">);</span></li><li class="L8" style="color: silver;"><span class="pln" style="color: rgb(0, 0, 0);"> </span><span class="typ" style="color: rgb(102, 0, 102);">Control</span><span class="pln" style="color: rgb(0, 0, 0);"> ctrl2 </span><span class="pun" style="color: rgb(102, 102, 0);">=</span><span class="pln" style="color: rgb(0, 0, 0);"> </span><span class="kwd" style="color: rgb(0, 0, 136);">this</span><span class="pun" style="color: rgb(102, 102, 0);">.</span><span class="typ" style="color: rgb(102, 0, 102);">Controls</span><span class="pun" style="color: rgb(102, 102, 0);">.</span><span class="typ" style="color: rgb(102, 0, 102);">Find</span><span class="pun" style="color: rgb(102, 102, 0);">(</span><span class="pln" style="color: rgb(0, 0, 0);">tbName</span><span class="pun" style="color: rgb(102, 102, 0);">,</span><span class="pln" style="color: rgb(0, 0, 0);"> </span><span class="kwd" style="color: rgb(0, 0, 136);">true</span><span class="pun" style="color: rgb(102, 102, 0);">).</span><span class="typ" style="color: rgb(102, 0, 102);">FirstOrDefault</span><span class="pun" style="color: rgb(102, 102, 0);">();</span></li><li class="L9" style="color: silver; background: rgb(250, 250, 250);"><span class="pln" style="color: rgb(0, 0, 0);"> </span><span class="kwd" style="color: rgb(0, 0, 136);">if</span><span class="pln" style="color: rgb(0, 0, 0);"> </span><span class="pun" style="color: rgb(102, 102, 0);">(</span><span class="pln" style="color: rgb(0, 0, 0);">ctrl2 </span><span class="pun" style="color: rgb(102, 102, 0);">!=</span><span class="pln" style="color: rgb(0, 0, 0);"> </span><span class="kwd" style="color: rgb(0, 0, 136);">null</span><span class="pln" style="color: rgb(0, 0, 0);"> </span><span class="pun" style="color: rgb(102, 102, 0);">&amp;&amp;</span><span class="pln" style="color: rgb(0, 0, 0);"> ctrl2 </span><span class="kwd" style="color: rgb(0, 0, 136);">is</span><span class="pln" style="color: rgb(0, 0, 0);"> </span>TextEdit<span class="pun" style="color: rgb(102, 102, 0);">)</span></li><li class="L0" style="color: silver;"><span class="pln" style="color: rgb(0, 0, 0);"> </span><span class="pun" style="color: rgb(102, 102, 0);">{</span></li><li class="L1" style="color: silver; background: rgb(250, 250, 250);"><span class="pln" style="color: rgb(0, 0, 0);"> </span><span class="pun" style="color: rgb(102, 102, 0);">((</span><span class="typ" style="color: rgb(102, 0, 102);">TextEdit</span><span class="pun" style="color: rgb(102, 102, 0);">)</span><span class="pln" style="color: rgb(0, 0, 0);">ctrl2</span><span class="pun" style="color: rgb(102, 102, 0);">).</span><span class="typ" style="color: rgb(102, 0, 102);">Enabled</span><span class="pln" style="color: rgb(0, 0, 0);"> </span><span class="pun" style="color: rgb(102, 102, 0);">=</span><span class="pln" style="color: rgb(0, 0, 0);"> </span><span class="pun" style="color: rgb(102, 102, 0);">((</span>ComboBoxEdit<span class="pln" style="color: rgb(0, 0, 0);"> </span><span class="pun" style="color: rgb(102, 102, 0);">)</span><span class="pln" style="color: rgb(0, 0, 0);">ctrl1</span><span class="pun" style="color: rgb(102, 102, 0);">).</span><span class="typ" style="color: rgb(102, 0, 102);">SelectedIndex</span><span class="pln" style="color: rgb(0, 0, 0);"> </span><span class="pun" style="color: rgb(102, 102, 0);">&gt;</span><span class="pln" style="color: rgb(0, 0, 0);"> </span><span class="pun" style="color: rgb(102, 102, 0);">-</span><span class="lit" style="color: rgb(0, 102, 102);">1</span><span class="pun" style="color: rgb(102, 102, 0);">;</span></li><li class="L2" style="color: silver;"><span class="pln" style="color: rgb(0, 0, 0);"> </span><span class="pun" style="color: rgb(102, 102, 0);">}</span></li><li class="L3" style="color: silver; background: rgb(250, 250, 250);"><span class="pln" style="color: rgb(0, 0, 0);"> </span><span class="pun" style="color: rgb(102, 102, 0);">}</span></li><li class="L4" style="color: silver;"><span class="pln" style="color: rgb(0, 0, 0);"> </span><span class="pun" style="color: rgb(102, 102, 0);">}</span></li><li class="L5" style="color: silver; background: rgb(250, 250, 250);"><span class="pln" style="color: rgb(0, 0, 0);"> </span><span class="pun" style="color: rgb(102, 102, 0);">}</span></li>
Ekleyen: hakanndogann
Değiştiren: hakanndogann
03.02.20 17:52
Devexpress kullandığım için çalışmıyor galiba. Şu şekilde değiştirmiştim. ... private void cmb1_SelectedIndexChanged ( object sender , EventArgs e ) { for ( int i = 0 ; i < this . Controls . Count ; i ++) { Control ctrl1 = this . Controls [ i ]; if ( ctrl1 is ComboBoxEdit && ctrl1 . Name . StartsWith ( "cmb" )) { String tbName = "text" + ctrl1 . Name . Replace ( "cmb" , "" ); Control ctrl2 = this . Controls . Find ( tbName , true ). FirstOrDefault (); if ( ctrl2 != null && ctrl2 is TextEdit ) { (( TextEdit ) ctrl2 ). Enabled = (( ComboBoxEdit ) ctrl1 ). SelectedIndex > - 1 ; } } } }
Ekleyen: hakanndogann

En fazla 3 eski durum gösterilir.