<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[TListBox: Ist ein Item selektiert?]]></title><description><![CDATA[<p>tach,<br />
irgendwie geht das nicht. hier der code</p>
<pre><code class="language-cpp">if(ListBox1-&gt;Items-&gt;Count &gt; 0)
            {
        		if(ListBox1-&gt;Selected[ListBox1-&gt;SelCount])
            	{
            		//ja es ist ein item ausgewählt
            	}
            	else
            	{
            		//nein, bitte ein item auswählen
            	}
            }
            else
            {
            	//keine einträge drin
            }
</code></pre>
<p>was mache ich falsch?<br />
und ausserdem: fängt der index nicht bei 0 an? weil wenn ich &gt; -1 mache, was dann 0 wäre, bekomme ich den fehler &quot;....überschreitet das maximum -1&quot;</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/87063/tlistbox-ist-ein-item-selektiert</link><generator>RSS for Node</generator><lastBuildDate>Sat, 04 Jul 2026 11:18:46 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/87063.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 25 Sep 2004 16:51:23 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to TListBox: Ist ein Item selektiert? on Sat, 25 Sep 2004 16:51:23 GMT]]></title><description><![CDATA[<p>tach,<br />
irgendwie geht das nicht. hier der code</p>
<pre><code class="language-cpp">if(ListBox1-&gt;Items-&gt;Count &gt; 0)
            {
        		if(ListBox1-&gt;Selected[ListBox1-&gt;SelCount])
            	{
            		//ja es ist ein item ausgewählt
            	}
            	else
            	{
            		//nein, bitte ein item auswählen
            	}
            }
            else
            {
            	//keine einträge drin
            }
</code></pre>
<p>was mache ich falsch?<br />
und ausserdem: fängt der index nicht bei 0 an? weil wenn ich &gt; -1 mache, was dann 0 wäre, bekomme ich den fehler &quot;....überschreitet das maximum -1&quot;</p>
]]></description><link>https://www.c-plusplus.net/forum/post/614881</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/614881</guid><dc:creator><![CDATA[foooogy]]></dc:creator><pubDate>Sat, 25 Sep 2004 16:51:23 GMT</pubDate></item><item><title><![CDATA[Reply to TListBox: Ist ein Item selektiert? on Sat, 25 Sep 2004 17:12:06 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">for(int i = 0; i&lt;ListBox1-&gt;Items-&gt;Count; i++)
{
    if(ListBox1-&gt;Selected[i])
    {
        //ja es ist ein item ausgewählt
    }
}
</code></pre>
<p>foooogy schrieb:</p>
<blockquote>
<p>und ausserdem: fängt der index nicht bei 0 an? weil wenn ich &gt; -1 mache, was dann 0 wäre, bekomme ich den fehler &quot;....überschreitet das maximum -1&quot;</p>
</blockquote>
<p>Der Index fängt bei 0 an. wenn du bei -1 anfängst zu zählen, wirft die ListBox eine Exception, das du den Index überschritten hast, weil du ja VOR Index 0 anfängst und dort nichts vorhanden ist.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/614884</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/614884</guid><dc:creator><![CDATA[PuppetMaster2k]]></dc:creator><pubDate>Sat, 25 Sep 2004 17:12:06 GMT</pubDate></item><item><title><![CDATA[Reply to TListBox: Ist ein Item selektiert? on Sat, 25 Sep 2004 18:44:30 GMT]]></title><description><![CDATA[<p>danke für deine hilfe.<br />
geht das auch ohne schleife? <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f644.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--face_with_rolling_eyes"
      title=":rolling_eyes:"
      alt="🙄"
    /> <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /></p>
<p>und was den index betrifft. ich war der meinung das ich ja in der if-anweisung mit dem grösser als operator abfrage, ob -1 grösser ist. somit muss die abfrage ja 0 (null) und grösser ergeben. nicht?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/614920</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/614920</guid><dc:creator><![CDATA[foooogy]]></dc:creator><pubDate>Sat, 25 Sep 2004 18:44:30 GMT</pubDate></item><item><title><![CDATA[Reply to TListBox: Ist ein Item selektiert? on Sat, 25 Sep 2004 19:59:52 GMT]]></title><description><![CDATA[<p>Das geht natürlich auch ohne Schleife. Wenn du abfragst ob etwas grösser -1 ist, erhälst du aus der if-Anweisung entweder true oder false, sonst nichts.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/614948</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/614948</guid><dc:creator><![CDATA[PuppetMaster2k]]></dc:creator><pubDate>Sat, 25 Sep 2004 19:59:52 GMT</pubDate></item><item><title><![CDATA[Reply to TListBox: Ist ein Item selektiert? on Sun, 26 Sep 2004 08:58:39 GMT]]></title><description><![CDATA[<p>foooogy,<br />
der klassische Weg geht eher über TListBox::ItemIndex. Der Wert hängt davon ab, ob Du Multi-Select zuläßt oder nicht (siehe BCB-Hilfe).</p>
]]></description><link>https://www.c-plusplus.net/forum/post/615070</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/615070</guid><dc:creator><![CDATA[dschensky]]></dc:creator><pubDate>Sun, 26 Sep 2004 08:58:39 GMT</pubDate></item></channel></rss>