<?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[ListBox-Hilfe benötigt]]></title><description><![CDATA[<p>1. Hallo, wie kann ich mein Programm so umschreiben, dass in einem Label angezeigt wird, wieviele Zeichen der Eintrag, den man mit doppelklicken in der ListBox1 ausgewählt hat, lang ist ?</p>
<p>Also ich habs so irgentwie versucht, aber ich komm auf keinen grünen Zweig.<br />
Bitte helfen!</p>
<pre><code class="language-cpp">void __fastcall TForm1::ListBox1DblClick(TObject *Sender)
{
int Anzahl,x,summe,i;

x=ListBox1-&gt;ItemIndex;

    for(x=Anzahl;x&gt;=1;x--)
     {
      switch(ListBox1-&gt;Items-&gt;Strings[x])
      case 'a':
      case 'b':
      case 'c':
      case 'd':
      case 'e':
      case 'f':
      case 'g':
      case 'h':
      case 'i':
      case 'j':
      case 'k':
      case 'l':
      case 'm':
      case 'n':
      case 'o':
      case 'p':
      case 'q':
      case 'r':
      case 's':
      case 't':
      case 'u':
      case 'v':
      case 'w':
      case 'x':
      case 'y':
      case 'z':

         {
       summe++;
         }
     }

Panel1-&gt;Visible=true;
Label1-&gt;Caption=&quot;Der gewählte Eintrag ist &quot; + IntToStr(summe)+ &quot; Zeichen lang.&quot;;
}
//---------------------------------------------------------------------------
</code></pre>
<p>2. Ich möchte einen markierten Eintrag per ENTFERNEN-Taste löschen!<br />
Es geht zwar, aber sicher nicht RICHTIG^^ Kann das wer umschreiben?<br />
BITTE!!!</p>
<pre><code class="language-cpp">void __fastcall TForm1::ListBox1KeyDown(TObject *Sender, WORD &amp;Key,
      TShiftState Shift)
{
int i;
if (Key==46)
 {
     for (i=0;i&lt;ListBox1-&gt;Items-&gt;Count;i++)
     {
       ListBox1-&gt;Items-&gt;Delete(i);
     }

 }
}
</code></pre>
<p>Vielen Dank im Voraus!<br />
MFG</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/176845/listbox-hilfe-benötigt</link><generator>RSS for Node</generator><lastBuildDate>Sat, 15 Aug 2026 06:27:52 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/176845.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 25 Mar 2007 17:47:47 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to ListBox-Hilfe benötigt on Sun, 25 Mar 2007 17:47:47 GMT]]></title><description><![CDATA[<p>1. Hallo, wie kann ich mein Programm so umschreiben, dass in einem Label angezeigt wird, wieviele Zeichen der Eintrag, den man mit doppelklicken in der ListBox1 ausgewählt hat, lang ist ?</p>
<p>Also ich habs so irgentwie versucht, aber ich komm auf keinen grünen Zweig.<br />
Bitte helfen!</p>
<pre><code class="language-cpp">void __fastcall TForm1::ListBox1DblClick(TObject *Sender)
{
int Anzahl,x,summe,i;

x=ListBox1-&gt;ItemIndex;

    for(x=Anzahl;x&gt;=1;x--)
     {
      switch(ListBox1-&gt;Items-&gt;Strings[x])
      case 'a':
      case 'b':
      case 'c':
      case 'd':
      case 'e':
      case 'f':
      case 'g':
      case 'h':
      case 'i':
      case 'j':
      case 'k':
      case 'l':
      case 'm':
      case 'n':
      case 'o':
      case 'p':
      case 'q':
      case 'r':
      case 's':
      case 't':
      case 'u':
      case 'v':
      case 'w':
      case 'x':
      case 'y':
      case 'z':

         {
       summe++;
         }
     }

Panel1-&gt;Visible=true;
Label1-&gt;Caption=&quot;Der gewählte Eintrag ist &quot; + IntToStr(summe)+ &quot; Zeichen lang.&quot;;
}
//---------------------------------------------------------------------------
</code></pre>
<p>2. Ich möchte einen markierten Eintrag per ENTFERNEN-Taste löschen!<br />
Es geht zwar, aber sicher nicht RICHTIG^^ Kann das wer umschreiben?<br />
BITTE!!!</p>
<pre><code class="language-cpp">void __fastcall TForm1::ListBox1KeyDown(TObject *Sender, WORD &amp;Key,
      TShiftState Shift)
{
int i;
if (Key==46)
 {
     for (i=0;i&lt;ListBox1-&gt;Items-&gt;Count;i++)
     {
       ListBox1-&gt;Items-&gt;Delete(i);
     }

 }
}
</code></pre>
<p>Vielen Dank im Voraus!<br />
MFG</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1252378</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1252378</guid><dc:creator><![CDATA[LoSt]]></dc:creator><pubDate>Sun, 25 Mar 2007 17:47:47 GMT</pubDate></item><item><title><![CDATA[Reply to ListBox-Hilfe benötigt on Sun, 25 Mar 2007 17:54:05 GMT]]></title><description><![CDATA[<p>zu 1.) Schau Dir mal die Eigenschaft ItemIndex von TListBox in Verbindung mit TListBox::Items[] Length() in der Hilfe an.</p>
<p>zu 2.) siehe eigentlich wieder 1.) ItemIndex wird Dein Freund sein.</p>
<p>Gruss</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1252387</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1252387</guid><dc:creator><![CDATA[Rostfrei**]]></dc:creator><pubDate>Sun, 25 Mar 2007 17:54:05 GMT</pubDate></item><item><title><![CDATA[Reply to ListBox-Hilfe benötigt on Sun, 25 Mar 2007 18:09:35 GMT]]></title><description><![CDATA[<p>Ja dort hab ich eh auch schon nachgeschaut aber ich werd daraus nicht schlau.. sry <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f615.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--confused_face"
      title=":confused:"
      alt="😕"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1252407</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1252407</guid><dc:creator><![CDATA[LoSt]]></dc:creator><pubDate>Sun, 25 Mar 2007 18:09:35 GMT</pubDate></item><item><title><![CDATA[Reply to ListBox-Hilfe benötigt on Sun, 25 Mar 2007 18:11:12 GMT]]></title><description><![CDATA[<p>Warum nich?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1252409</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1252409</guid><dc:creator><![CDATA[WebFritzi]]></dc:creator><pubDate>Sun, 25 Mar 2007 18:11:12 GMT</pubDate></item><item><title><![CDATA[Reply to ListBox-Hilfe benötigt on Sun, 25 Mar 2007 18:16:55 GMT]]></title><description><![CDATA[<p>weil ich nich weiß was ich nun tun soll -.-</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1252416</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1252416</guid><dc:creator><![CDATA[LoSt]]></dc:creator><pubDate>Sun, 25 Mar 2007 18:16:55 GMT</pubDate></item><item><title><![CDATA[Reply to ListBox-Hilfe benötigt on Sun, 25 Mar 2007 18:19:20 GMT]]></title><description><![CDATA[<p>Ist dir denn klar, was die Member-Funktion ItemIndex() macht?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1252418</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1252418</guid><dc:creator><![CDATA[WebFritzi]]></dc:creator><pubDate>Sun, 25 Mar 2007 18:19:20 GMT</pubDate></item><item><title><![CDATA[Reply to ListBox-Hilfe benötigt on Sun, 25 Mar 2007 19:11:41 GMT]]></title><description><![CDATA[<p>Hallo</p>
<p>TListBox::ItemIndex ist doch keine Funktion, sondern eine Eigenschaft.</p>
<p>Letztendlich kann man die beiden Probleme auf je einen Einzeile reduzieren<br />
1.</p>
<pre><code class="language-cpp">Label1-&gt;Caption = ListBox1-&gt;Items-&gt;Strings[ListBox1-&gt;ItemIndex].Length();
</code></pre>
<ol start="2">
<li></li>
</ol>
<pre><code class="language-cpp">ListBox1-&gt;Items-&gt;Delete(ListBox1-&gt;ItemIndex);
</code></pre>
<p>Natürlich sollte vorher auf jedenfall geprüft werden ob überhaupt etwas ausgewählt ist (ItemIndex != -1)</p>
<p>bis bald<br />
akari</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1252464</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1252464</guid><dc:creator><![CDATA[akari]]></dc:creator><pubDate>Sun, 25 Mar 2007 19:11:41 GMT</pubDate></item><item><title><![CDATA[Reply to ListBox-Hilfe benötigt on Sun, 25 Mar 2007 19:08:05 GMT]]></title><description><![CDATA[<p>akari schrieb:</p>
<blockquote>
<p>TListBox::ItemIndex ist doch keine Funktion, sondern eine Eigenschaft.</p>
</blockquote>
<p>Huuups. <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="🙄"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1252467</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1252467</guid><dc:creator><![CDATA[WebFritzi]]></dc:creator><pubDate>Sun, 25 Mar 2007 19:08:05 GMT</pubDate></item><item><title><![CDATA[Reply to ListBox-Hilfe benötigt on Mon, 26 Mar 2007 07:13:37 GMT]]></title><description><![CDATA[<p>Danke<br />
1. ist abgehackt. gelöst. Danke akari!</p>
<p>2. Ja es geht SCHON, aber wie vorher.<br />
Alles was über dem markierten Eintrag ist, wird auch mitgelöscht.<br />
Da muss man glaub ich die for-Schleife anders machen..<br />
Aber ich hab keine Ahnung wie...</p>
<p>MFG</p>
<pre><code class="language-cpp">void __fastcall TForm1::ListBox1KeyDown(TObject *Sender, WORD &amp;Key,
      TShiftState Shift)
{
int i;

if (Key==46)
 {
     ListBox1-&gt;ItemIndex != -1;
     for (i=0;i&lt;ListBox1-&gt;Items-&gt;Count;i++)
     {
       ListBox1-&gt;Items-&gt;Delete(ListBox1-&gt;ItemIndex);
     }

 }
}
</code></pre>
<p>edit:<br />
ok habs selber geschafft.<br />
Lösung:</p>
<pre><code class="language-cpp">void __fastcall TForm1::ListBox1KeyDown(TObject *Sender, WORD &amp;Key,
      TShiftState Shift)
{
int i;

if (Key==46)
{
for (i=ListBox1-&gt;Items-&gt;Count-1;i&gt;=0;i--)
{
 if (ListBox1-&gt;Selected[i]==true)
  {
   ListBox1-&gt;Items-&gt;Delete(i);
  }
 }
}
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1252648</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1252648</guid><dc:creator><![CDATA[LoSt]]></dc:creator><pubDate>Mon, 26 Mar 2007 07:13:37 GMT</pubDate></item><item><title><![CDATA[Reply to ListBox-Hilfe benötigt on Mon, 26 Mar 2007 07:08:57 GMT]]></title><description><![CDATA[<p>Hallo</p>
<blockquote>
<p>2. Ja es geht SCHON, aber wie vorher.<br />
Alles was über dem markierten Eintrag ist, wird auch mitgelöscht.</p>
</blockquote>
<p>Kann gar nicht sein. Der Quellcode von mir löscht maximal 1 Eintrag.</p>
<blockquote>
<p>Da muss man glaub ich die for-Schleife anders machen..</p>
</blockquote>
<p>Wenn du den ausgewählten Eintrag löschen willst brauchst du keine Schleife.</p>
<p>bis bald<br />
akari</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1252652</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1252652</guid><dc:creator><![CDATA[akari]]></dc:creator><pubDate>Mon, 26 Mar 2007 07:08:57 GMT</pubDate></item><item><title><![CDATA[Reply to ListBox-Hilfe benötigt on Mon, 26 Mar 2007 17:11:06 GMT]]></title><description><![CDATA[<p>akari schrieb:</p>
<blockquote>
<p>Kann gar nicht sein. Der Quellcode von mir löscht maximal 1 Eintrag.</p>
<p>Wenn du den ausgewählten Eintrag löschen willst brauchst du keine Schleife.</p>
</blockquote>
<p>ich wollte ja nicht nur EINEN eintrag löschen sondern mehrere markierte</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1253180</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1253180</guid><dc:creator><![CDATA[LoSt]]></dc:creator><pubDate>Mon, 26 Mar 2007 17:11:06 GMT</pubDate></item><item><title><![CDATA[Reply to ListBox-Hilfe benötigt on Mon, 26 Mar 2007 17:56:55 GMT]]></title><description><![CDATA[<p>Hallo</p>
<p>Anfangspost schrieb:</p>
<blockquote>
<p>2. Ich möchte einen markierten Eintrag per ENTFERNEN-Taste löschen!</p>
</blockquote>
<p><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="🙄"
    /><br />
Dann solltest du deine Fragen auch dementsprechend stellen!<br />
Und wenn du jetzt noch sagst nach welchem Muster die zu löschenden Einträge gefunden werden sollen könnte dir auch jemand helfen.</p>
<p>bis bald<br />
akari</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1253219</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1253219</guid><dc:creator><![CDATA[akari]]></dc:creator><pubDate>Mon, 26 Mar 2007 17:56:55 GMT</pubDate></item><item><title><![CDATA[Reply to ListBox-Hilfe benötigt on Tue, 27 Mar 2007 11:55:17 GMT]]></title><description><![CDATA[<p>sry <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f61e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--disappointed_face"
      title=":("
      alt="😞"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1253746</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1253746</guid><dc:creator><![CDATA[LoSt]]></dc:creator><pubDate>Tue, 27 Mar 2007 11:55:17 GMT</pubDate></item></channel></rss>