<?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]]></title><description><![CDATA[<p>Hey, also ich hätte da ne Frage.<br />
Wie kann ich es bei meinem Programm einstellen, dass es immer bei nem bestimmten Label anzeigt, wieviele Einträge gerade vorhanden sind?<br />
Ich hab echt keine Ahnung wie ich es an gehen soll.<br />
Hätt gern das die Caption des Labels dann so in der Art wär&quot;Es befinden sich ?? Einträge in der Listbox.&quot; statt &quot;??&quot; natürlich die richtige Anzahl.<br />
Kann mir wer das machen? Ist glaub ich eh ganz leicht, nur ich checks halt nit. Bitte bitte antworten. Hier das ganze Programm:</p>
<pre><code class="language-cpp">//---------------------------------------------------------------------------
#include &lt;vcl.h&gt;
#pragma hdrstop

#include &quot;Unit1.h&quot;
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource &quot;*.dfm&quot;
TForm1 *Form1;
int Auswahl=0;

//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
    : TForm(Owner)
{

}
//---------------------------------------------------------------------------

void __fastcall TForm1::Ende1Click(TObject *Sender)
{
Close();
}
//---------------------------------------------------------------------------

void __fastcall TForm1::FormClose(TObject *Sender, TCloseAction &amp;Action)
{
Action=caFree;
}
//---------------------------------------------------------------------------

void __fastcall TForm1::AllesLschen1Click(TObject *Sender)
{
if (Application-&gt;MessageBox(&quot;Wollen Sie wirklich alles löschen?&quot;,&quot;Warnung!&quot;,MB_YESNO|MB_ICONWARNING)==IDYES)
{
ListBox1-&gt;Clear();
}
}
//---------------------------------------------------------------------------

void __fastcall TForm1::Sortieren1Click(TObject *Sender)
{
if (ListBox1-&gt;Sorted==true)
{
ListBox1-&gt;Sorted=false;
Sortieren1-&gt;Checked=false;
}
else
{
ListBox1-&gt;Sorted=true;
Sortieren1-&gt;Checked=true;
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Eintraglschen1Click(TObject *Sender)

{
Application-&gt;MessageBox(&quot;Wählen Sie einen Eintrag und drücken Sie ENTF!&quot;,&quot;Warnung!&quot;,MB_OK);
}

//---------------------------------------------------------------------------
void __fastcall TForm1::ListBox1KeyDown(TObject *Sender, WORD &amp;Key,
      TShiftState Shift)
{
int marke;
if (Key==46)
{
marke=ListBox1-&gt;ItemIndex;
ListBox1-&gt;Items-&gt;Delete(marke);
}
 if (Key==45)
 {
  Panel1-&gt;Visible=true;
  Label1-&gt;Caption=&quot;Einzüfügender Eintrag&quot;;
  Edit1-&gt;SetFocus();
  Auswahl=2;

 }

}
//---------------------------------------------------------------------------
void __fastcall TForm1::Eintraganhngen1Click(TObject *Sender)
{

Panel1-&gt;Visible=true;
Edit1-&gt;Text=&quot;&quot;;
Edit1-&gt;SetFocus();
Auswahl=1;
}
//---------------------------------------------------------------------------

void __fastcall TForm1::Edit1KeyDown(TObject *Sender, WORD &amp;Key,
      TShiftState Shift)
{
if (Key==13)
{
 if (Edit1-&gt;Text&gt;&quot;&quot;)
 {
 ListBox1-&gt;Sorted=false;
 Sortieren1-&gt;Checked=false;
 if (Auswahl==1)
 {
  ListBox1-&gt;Items-&gt;Add(Edit1-&gt;Text);
 }
 if (Auswahl==2)
 {
 ListBox1-&gt;Items-&gt;Insert(ListBox1-&gt;ItemIndex,Edit1-&gt;Text);
 }
 Edit1-&gt;Text=&quot;&quot;;
 }
 Panel1-&gt;Visible=false;
 Auswahl=0;
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Listespeichern1Click(TObject *Sender)
{
 if (SaveDialog1-&gt;Execute()==true)
 {
ListBox1-&gt;Items-&gt;SaveToFile(SaveDialog1-&gt;FileName);
 }
}
//---------------------------------------------------------------------------

void __fastcall TForm1::Listeladen1Click(TObject *Sender)
{
if(OpenDialog1-&gt;Execute()==true)
{
ListBox1-&gt;Items-&gt;LoadFromFile(OpenDialog1-&gt;FileName);
}
}
//---------------------------------------------------------------------------

void __fastcall TForm1::Eintrageinfgen1Click(TObject *Sender)
{
Application-&gt;MessageBox(&quot;Wählen Sie die Stelle und drücken Sie die Einfügetaste!&quot;,&quot;Warnung!&quot;,MB_OK);
}
//---------------------------------------------------------------------------
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/topic/175608/listbox</link><generator>RSS for Node</generator><lastBuildDate>Sat, 15 Aug 2026 00:57:23 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/175608.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 12 Mar 2007 14:25:00 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to ListBox on Mon, 12 Mar 2007 14:25:00 GMT]]></title><description><![CDATA[<p>Hey, also ich hätte da ne Frage.<br />
Wie kann ich es bei meinem Programm einstellen, dass es immer bei nem bestimmten Label anzeigt, wieviele Einträge gerade vorhanden sind?<br />
Ich hab echt keine Ahnung wie ich es an gehen soll.<br />
Hätt gern das die Caption des Labels dann so in der Art wär&quot;Es befinden sich ?? Einträge in der Listbox.&quot; statt &quot;??&quot; natürlich die richtige Anzahl.<br />
Kann mir wer das machen? Ist glaub ich eh ganz leicht, nur ich checks halt nit. Bitte bitte antworten. Hier das ganze Programm:</p>
<pre><code class="language-cpp">//---------------------------------------------------------------------------
#include &lt;vcl.h&gt;
#pragma hdrstop

#include &quot;Unit1.h&quot;
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource &quot;*.dfm&quot;
TForm1 *Form1;
int Auswahl=0;

//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
    : TForm(Owner)
{

}
//---------------------------------------------------------------------------

void __fastcall TForm1::Ende1Click(TObject *Sender)
{
Close();
}
//---------------------------------------------------------------------------

void __fastcall TForm1::FormClose(TObject *Sender, TCloseAction &amp;Action)
{
Action=caFree;
}
//---------------------------------------------------------------------------

void __fastcall TForm1::AllesLschen1Click(TObject *Sender)
{
if (Application-&gt;MessageBox(&quot;Wollen Sie wirklich alles löschen?&quot;,&quot;Warnung!&quot;,MB_YESNO|MB_ICONWARNING)==IDYES)
{
ListBox1-&gt;Clear();
}
}
//---------------------------------------------------------------------------

void __fastcall TForm1::Sortieren1Click(TObject *Sender)
{
if (ListBox1-&gt;Sorted==true)
{
ListBox1-&gt;Sorted=false;
Sortieren1-&gt;Checked=false;
}
else
{
ListBox1-&gt;Sorted=true;
Sortieren1-&gt;Checked=true;
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Eintraglschen1Click(TObject *Sender)

{
Application-&gt;MessageBox(&quot;Wählen Sie einen Eintrag und drücken Sie ENTF!&quot;,&quot;Warnung!&quot;,MB_OK);
}

//---------------------------------------------------------------------------
void __fastcall TForm1::ListBox1KeyDown(TObject *Sender, WORD &amp;Key,
      TShiftState Shift)
{
int marke;
if (Key==46)
{
marke=ListBox1-&gt;ItemIndex;
ListBox1-&gt;Items-&gt;Delete(marke);
}
 if (Key==45)
 {
  Panel1-&gt;Visible=true;
  Label1-&gt;Caption=&quot;Einzüfügender Eintrag&quot;;
  Edit1-&gt;SetFocus();
  Auswahl=2;

 }

}
//---------------------------------------------------------------------------
void __fastcall TForm1::Eintraganhngen1Click(TObject *Sender)
{

Panel1-&gt;Visible=true;
Edit1-&gt;Text=&quot;&quot;;
Edit1-&gt;SetFocus();
Auswahl=1;
}
//---------------------------------------------------------------------------

void __fastcall TForm1::Edit1KeyDown(TObject *Sender, WORD &amp;Key,
      TShiftState Shift)
{
if (Key==13)
{
 if (Edit1-&gt;Text&gt;&quot;&quot;)
 {
 ListBox1-&gt;Sorted=false;
 Sortieren1-&gt;Checked=false;
 if (Auswahl==1)
 {
  ListBox1-&gt;Items-&gt;Add(Edit1-&gt;Text);
 }
 if (Auswahl==2)
 {
 ListBox1-&gt;Items-&gt;Insert(ListBox1-&gt;ItemIndex,Edit1-&gt;Text);
 }
 Edit1-&gt;Text=&quot;&quot;;
 }
 Panel1-&gt;Visible=false;
 Auswahl=0;
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Listespeichern1Click(TObject *Sender)
{
 if (SaveDialog1-&gt;Execute()==true)
 {
ListBox1-&gt;Items-&gt;SaveToFile(SaveDialog1-&gt;FileName);
 }
}
//---------------------------------------------------------------------------

void __fastcall TForm1::Listeladen1Click(TObject *Sender)
{
if(OpenDialog1-&gt;Execute()==true)
{
ListBox1-&gt;Items-&gt;LoadFromFile(OpenDialog1-&gt;FileName);
}
}
//---------------------------------------------------------------------------

void __fastcall TForm1::Eintrageinfgen1Click(TObject *Sender)
{
Application-&gt;MessageBox(&quot;Wählen Sie die Stelle und drücken Sie die Einfügetaste!&quot;,&quot;Warnung!&quot;,MB_OK);
}
//---------------------------------------------------------------------------
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1244016</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1244016</guid><dc:creator><![CDATA[LoSt]]></dc:creator><pubDate>Mon, 12 Mar 2007 14:25:00 GMT</pubDate></item><item><title><![CDATA[Reply to ListBox on Mon, 12 Mar 2007 14:34:53 GMT]]></title><description><![CDATA[<p>Hallo</p>
<p>nach jedem <em>ListBox1-&gt;Items-&gt;Insert(...)</em>, <em>ListBox1-&gt;Items-&gt;Add(...)</em> oder <em>ListBox1-&gt;Items-&gt;Delete(...)</em> einfach</p>
<pre><code class="language-cpp">Label1-&gt;Caption = AnsiString(&quot;Es befinden sich &quot;) + IntToStr(ListBox1-&gt;Items-&gt;Count) + &quot; Einträge in der Listbox&quot;;
</code></pre>
<p>P.S. : Das gehört ins Builder-Forum</p>
<p>bis bald<br />
akari</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1244033</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1244033</guid><dc:creator><![CDATA[akari]]></dc:creator><pubDate>Mon, 12 Mar 2007 14:34:53 GMT</pubDate></item><item><title><![CDATA[Reply to ListBox on Mon, 12 Mar 2007 14:49:39 GMT]]></title><description><![CDATA[<p>Hallo akari.<br />
erstmals danke für die schnelle Antwort!!!! <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f44d.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--thumbs_up"
      title=":+1:"
      alt="👍"
    /> <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f44d.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--thumbs_up"
      title=":+1:"
      alt="👍"
    /> <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f44d.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--thumbs_up"
      title=":+1:"
      alt="👍"
    /></p>
<p>jo es funzt jetzt.. eh klar <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f576.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--sunglasses"
      title=":sunglasses:"
      alt="🕶"
    /><br />
Hab dazu auch ganz oben das auch eingefügt. Dann wirds am anfang auch schon angezeigt.<br />
Dort im __fastcall TForm1 darf ich das eh rein tun oder?</p>
<pre><code class="language-cpp">__fastcall TForm1::TForm1(TComponent* Owner)
    : TForm(Owner)
{
 Label2-&gt;Caption = &quot;Es befinden sich &quot; + IntToStr(ListBox1-&gt;Items-&gt;Count) + &quot; Einträge in der Listbox&quot;;
}
</code></pre>
<p>mfg</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1244052</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1244052</guid><dc:creator><![CDATA[LoSt]]></dc:creator><pubDate>Mon, 12 Mar 2007 14:49:39 GMT</pubDate></item><item><title><![CDATA[Reply to ListBox on Mon, 12 Mar 2007 14:59:04 GMT]]></title><description><![CDATA[<p>Hallo</p>
<p>Ja das darfst du auch. Damit wird die Anzeige beim Programmstart initialisiert, das eben 0 Items vorhanden sind.<br />
Diese spezielle Methode heißt übrigens Konstruktor.</p>
<p>bis bald<br />
akari</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1244069</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1244069</guid><dc:creator><![CDATA[akari]]></dc:creator><pubDate>Mon, 12 Mar 2007 14:59:04 GMT</pubDate></item><item><title><![CDATA[Reply to ListBox on Mon, 12 Mar 2007 15:06:10 GMT]]></title><description><![CDATA[<p>aso ja aber es sind eh am Anfang auch schon 6 Items bei mir in der Listbox vorhanden. Aber das konntest du ja nicht wissen, also ok . danke für alles.<br />
mfg</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1244079</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1244079</guid><dc:creator><![CDATA[LoSt]]></dc:creator><pubDate>Mon, 12 Mar 2007 15:06:10 GMT</pubDate></item><item><title><![CDATA[Reply to ListBox on Wed, 14 Mar 2007 11:49:04 GMT]]></title><description><![CDATA[<p>Dieser Thread wurde von Moderator/in <a href="http://www.c-plusplus.net/forum/profile-var-mode-is-viewprofile-and-u-is-403.html" rel="nofollow">HumeSikkins</a> aus dem Forum <a href="http://www.c-plusplus.net/forum/viewforum-var-f-is-15.html" rel="nofollow">C++</a> in das Forum <a href="http://www.c-plusplus.net/forum/viewforum-var-f-is-2.html" rel="nofollow">VCL/CLX (Borland C++ Builder)</a> verschoben.</p>
<p>Im Zweifelsfall bitte auch folgende Hinweise beachten:<br />
<a href="http://www.c-plusplus.net/forum/viewtopic-var-t-is-39405.html" rel="nofollow">C/C++ Forum :: FAQ - Sonstiges :: Wohin mit meiner Frage?</a></p>
<p><em>Dieses Posting wurde automatisch erzeugt.</em></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1245327</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1245327</guid><dc:creator><![CDATA[C++ Forumbot]]></dc:creator><pubDate>Wed, 14 Mar 2007 11:49:04 GMT</pubDate></item></channel></rss>