<?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[ComboBox, Einträge abfragen]]></title><description><![CDATA[<p>Hallo,</p>
<p>ich habe kleine Schwierigkeiten mit der &quot;ComboBox&quot;. In meinem Test habe Ich eine ComboBox mit 3 Einträgen bestückt (Test1, Tes2 und Test3).</p>
<p>Nun möchte Ich wenn &quot;Test1&quot; ausgewählt wird, soll &quot;Label1&quot; &quot;Herzlichen&quot; heißen<br />
und wenn &quot;Test2&quot; ausgewählt wird, soll &quot;Label2&quot; &quot;Glückwunsch&quot; heißen.<br />
Wenn aber Test3 ausgewählt wird sollen sich beide Labels ändern.</p>
<pre><code class="language-cpp">void __fastcall TForm1::FormCreate(TObject *Sender)
{
ComboBox1-&gt;Items-&gt;Add(&quot;Test1&quot;);
ComboBox1-&gt;Items-&gt;Add(&quot;Test2&quot;);
ComboBox1-&gt;Items-&gt;Add(&quot;Test3&quot;);
}
//---------------------------------------------------------------------------
void __fastcall TForm1::ComboBox1Change(TObject *Sender)
{
if (ComboBox1-&gt;Items-&gt;Strings[ComboBox1-&gt;ItemIndex] == &quot;Test1&quot;);
   Label1-&gt;Caption = &quot;Herzlichen&quot;;
if (ComboBox1-&gt;Items-&gt;Strings[ComboBox1-&gt;ItemIndex] == &quot;Test2&quot;);
   Label2-&gt;Caption = &quot;Glückwunsch&quot;;
if (ComboBox1-&gt;Items-&gt;Strings[ComboBox1-&gt;ItemIndex] == &quot;Test3&quot;);
   Label1-&gt;Caption = &quot;Herzlichen&quot;;
   Label2-&gt;Caption = &quot;Glückwunsch&quot;;
}
//---------------------------------------------------------------------------
</code></pre>
<p>Dieser kleine Programmcode habe Ich mir zusammengebastelt mit jenen Kenntnisse die ein Anfänger besitzt :). Wenn Ich z.B. &quot;Test1&quot; auswähle, werden beide Labels geändert, was Ich nicht möchte.</p>
<p>-----------------------------------------------------------------------------</p>
<p>Im Internet habe Ich ein Beispiel gefunden, in der &quot;case&quot; verwendet wird.<br />
Jediglich folgt ein Fehler, wenn Ich dieses Bsp. nachmache und es heißt<br />
&quot;case-Maske außerhalb der switch-Anweisung&quot;</p>
<p>In der Programmhilfe kommt nur:</p>
<pre><code class="language-cpp">__property bool Selected[int Index] = {read=GetSelected, write=SetSelected};
</code></pre>
<p>was aber nur bei der ListBox geht.</p>
<p>Ich hoffe ihr versteht mein Problem und könnt mir helfen <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":)"
      alt="🙂"
    /></p>
<p>Mfg MHR</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/163512/combobox-einträge-abfragen</link><generator>RSS for Node</generator><lastBuildDate>Wed, 12 Aug 2026 02:44:27 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/163512.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 30 Oct 2006 13:35:53 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to ComboBox, Einträge abfragen on Mon, 30 Oct 2006 13:35:53 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>ich habe kleine Schwierigkeiten mit der &quot;ComboBox&quot;. In meinem Test habe Ich eine ComboBox mit 3 Einträgen bestückt (Test1, Tes2 und Test3).</p>
<p>Nun möchte Ich wenn &quot;Test1&quot; ausgewählt wird, soll &quot;Label1&quot; &quot;Herzlichen&quot; heißen<br />
und wenn &quot;Test2&quot; ausgewählt wird, soll &quot;Label2&quot; &quot;Glückwunsch&quot; heißen.<br />
Wenn aber Test3 ausgewählt wird sollen sich beide Labels ändern.</p>
<pre><code class="language-cpp">void __fastcall TForm1::FormCreate(TObject *Sender)
{
ComboBox1-&gt;Items-&gt;Add(&quot;Test1&quot;);
ComboBox1-&gt;Items-&gt;Add(&quot;Test2&quot;);
ComboBox1-&gt;Items-&gt;Add(&quot;Test3&quot;);
}
//---------------------------------------------------------------------------
void __fastcall TForm1::ComboBox1Change(TObject *Sender)
{
if (ComboBox1-&gt;Items-&gt;Strings[ComboBox1-&gt;ItemIndex] == &quot;Test1&quot;);
   Label1-&gt;Caption = &quot;Herzlichen&quot;;
if (ComboBox1-&gt;Items-&gt;Strings[ComboBox1-&gt;ItemIndex] == &quot;Test2&quot;);
   Label2-&gt;Caption = &quot;Glückwunsch&quot;;
if (ComboBox1-&gt;Items-&gt;Strings[ComboBox1-&gt;ItemIndex] == &quot;Test3&quot;);
   Label1-&gt;Caption = &quot;Herzlichen&quot;;
   Label2-&gt;Caption = &quot;Glückwunsch&quot;;
}
//---------------------------------------------------------------------------
</code></pre>
<p>Dieser kleine Programmcode habe Ich mir zusammengebastelt mit jenen Kenntnisse die ein Anfänger besitzt :). Wenn Ich z.B. &quot;Test1&quot; auswähle, werden beide Labels geändert, was Ich nicht möchte.</p>
<p>-----------------------------------------------------------------------------</p>
<p>Im Internet habe Ich ein Beispiel gefunden, in der &quot;case&quot; verwendet wird.<br />
Jediglich folgt ein Fehler, wenn Ich dieses Bsp. nachmache und es heißt<br />
&quot;case-Maske außerhalb der switch-Anweisung&quot;</p>
<p>In der Programmhilfe kommt nur:</p>
<pre><code class="language-cpp">__property bool Selected[int Index] = {read=GetSelected, write=SetSelected};
</code></pre>
<p>was aber nur bei der ListBox geht.</p>
<p>Ich hoffe ihr versteht mein Problem und könnt mir helfen <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":)"
      alt="🙂"
    /></p>
<p>Mfg MHR</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1164466</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1164466</guid><dc:creator><![CDATA[MHR]]></dc:creator><pubDate>Mon, 30 Oct 2006 13:35:53 GMT</pubDate></item><item><title><![CDATA[Reply to ComboBox, Einträge abfragen on Mon, 30 Oct 2006 13:47:06 GMT]]></title><description><![CDATA[<p>klar, schau dir einfach in der BCB-Hilfe das Beispiel zu &quot;if, else&quot; an<br />
dein Fehler sind der Syntax von If-Abfragen und die Klammerung</p>
<p>[Edit1] natürlich hilft auch <a href="http://www.c-plusplus.net/forum/viewtopic-var-t-is-39301.html" rel="nofollow">Debuggen</a><br />
hier noch etwas zur <a href="http://www.c-plusplus.net/forum/viewtopic-var-t-is-39300.html" rel="nofollow">Hilfe</a></p>
<p>[Edit2]das switch geht auch mit dem <em>ItemIndex</em></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1164475</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1164475</guid><dc:creator><![CDATA[Linnea]]></dc:creator><pubDate>Mon, 30 Oct 2006 13:47:06 GMT</pubDate></item><item><title><![CDATA[Reply to ComboBox, Einträge abfragen on Mon, 30 Oct 2006 13:52:28 GMT]]></title><description><![CDATA[<p>Hallo</p>
<p>du hast die Syntax für if noch nicht verstanden</p>
<pre><code class="language-cpp">if (ComboBox1-&gt;Items-&gt;Strings[ComboBox1-&gt;ItemIndex] == &quot;Test1&quot;) // Kein Semikolon
   Label1-&gt;Caption = &quot;Herzlichen&quot;;
if (ComboBox1-&gt;Items-&gt;Strings[ComboBox1-&gt;ItemIndex] == &quot;Test2&quot;) // Kein Semikolon
   Label2-&gt;Caption = &quot;Glückwunsch&quot;;
if (ComboBox1-&gt;Items-&gt;Strings[ComboBox1-&gt;ItemIndex] == &quot;Test3&quot;) // Kein Semikolon
{   // Bei mehreren Anweisungen must du einen neuen Codeblock öffnen
   Label1-&gt;Caption = &quot;Herzlichen&quot;;
   Label2-&gt;Caption = &quot;Glückwunsch&quot;; 
}
</code></pre>
<p>Das mit coase geht auch, aber nur bei Integralen Variablentypen (also nicht bei AnsiString, sondern nur bei int). Deshalb must du die Eigenschaft Selected anwenden.</p>
<pre><code class="language-cpp">switch (ComboBox1-&gt;ItemIndex)
{
  case 0 : Label1-&gt;Caption = &quot;Herzlichen&quot;; break;
  case 1 : Label2-&gt;Caption = &quot;Glückwunsch&quot;; break;
  case 2 : Label1-&gt;Caption = &quot;Herzlichen&quot;;
           Label2-&gt;Caption = &quot;Glückwunsch&quot;; break;
}
</code></pre>
<p>/Edit : bin doch zu langsam...<br />
und Selected in ItemIndex geändert</p>
<p>bis bald<br />
akari</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1164480</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1164480</guid><dc:creator><![CDATA[akari]]></dc:creator><pubDate>Mon, 30 Oct 2006 13:52:28 GMT</pubDate></item><item><title><![CDATA[Reply to ComboBox, Einträge abfragen on Mon, 30 Oct 2006 13:49:45 GMT]]></title><description><![CDATA[<p><a class="plugin-mentions-user plugin-mentions-a" href="https://www.c-plusplus.net/forum/uid/7971">@Akari</a><br />
bei <em>TComboBox</em> gibts kein Selected <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>
]]></description><link>https://www.c-plusplus.net/forum/post/1164484</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1164484</guid><dc:creator><![CDATA[Linnea]]></dc:creator><pubDate>Mon, 30 Oct 2006 13:49:45 GMT</pubDate></item><item><title><![CDATA[Reply to ComboBox, Einträge abfragen on Mon, 30 Oct 2006 13:55:42 GMT]]></title><description><![CDATA[<p>danke für die schnellen Antworten.</p>
<p>natürlich bin Ich noch nicht der Profi in der Geschichte <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":)"
      alt="🙂"
    /> aber man versucht sein möglichstes. Dann werde ich mir nochmal das Kapitel zu &quot;if, else...&quot; anschaun <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>danke MHR</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1164489</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1164489</guid><dc:creator><![CDATA[MHR]]></dc:creator><pubDate>Mon, 30 Oct 2006 13:55:42 GMT</pubDate></item></channel></rss>