<?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[Zugriff von Variablen auf anderes Formular]]></title><description><![CDATA[<p>Hi zusammen</p>
<p>Wie kann ich bei C++ Builder 5 die Variablen von einem Formular auf die andere Formular übertragen. z.B.<br />
Bei Unit1/Form1 habe ich folgende Variablen deklariert: int a=6; int b=8;<br />
Und bei Unit2/Form2 folgende Variablen deklariert: int c=9; Bei Form2 habe ich Label1 eingebaut.<br />
Nun möchte ich im Unit2/Form2 folgende Aussage überprüfen (Vergleich von 2 Variablen in verschiedenen Formulare):</p>
<pre><code>if (a==c) {Form2 -&gt; Label1 -&gt; Caption = &quot;wahre Aussage&quot;;}
else {Form2 -&gt; Label1 -&gt; Caption = &quot;falsche Aussage&quot;;}
</code></pre>
<p>Das Problem ist aber, dass bei Unit2/Form2 dieses a nicht deklariert ist. Ich hätte nur gerne den Wert von a auf Unit2/Form2 übernehmen, egal ob ich bei Unit2/Form2 eine neue Variable deklariere, etwa int d=a, damit der Wert von a aus Unit1/Form1 auf Unit2/Form2 übernommen wird, aber dann bleibt das Problem, da a nicht deklariert ist.</p>
<p>Hat jemand von euch eine Idee? Vielen Dank im Voraus <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>Lg Dominik</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/273781/zugriff-von-variablen-auf-anderes-formular</link><generator>RSS for Node</generator><lastBuildDate>Thu, 27 Aug 2026 23:32:04 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/273781.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 13 Sep 2010 11:05:24 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Zugriff von Variablen auf anderes Formular on Mon, 13 Sep 2010 11:05:24 GMT]]></title><description><![CDATA[<p>Hi zusammen</p>
<p>Wie kann ich bei C++ Builder 5 die Variablen von einem Formular auf die andere Formular übertragen. z.B.<br />
Bei Unit1/Form1 habe ich folgende Variablen deklariert: int a=6; int b=8;<br />
Und bei Unit2/Form2 folgende Variablen deklariert: int c=9; Bei Form2 habe ich Label1 eingebaut.<br />
Nun möchte ich im Unit2/Form2 folgende Aussage überprüfen (Vergleich von 2 Variablen in verschiedenen Formulare):</p>
<pre><code>if (a==c) {Form2 -&gt; Label1 -&gt; Caption = &quot;wahre Aussage&quot;;}
else {Form2 -&gt; Label1 -&gt; Caption = &quot;falsche Aussage&quot;;}
</code></pre>
<p>Das Problem ist aber, dass bei Unit2/Form2 dieses a nicht deklariert ist. Ich hätte nur gerne den Wert von a auf Unit2/Form2 übernehmen, egal ob ich bei Unit2/Form2 eine neue Variable deklariere, etwa int d=a, damit der Wert von a aus Unit1/Form1 auf Unit2/Form2 übernommen wird, aber dann bleibt das Problem, da a nicht deklariert ist.</p>
<p>Hat jemand von euch eine Idee? Vielen Dank im Voraus <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>Lg Dominik</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1951914</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1951914</guid><dc:creator><![CDATA[Dominik_88]]></dc:creator><pubDate>Mon, 13 Sep 2010 11:05:24 GMT</pubDate></item><item><title><![CDATA[Reply to Zugriff von Variablen auf anderes Formular on Mon, 13 Sep 2010 11:09:32 GMT]]></title><description><![CDATA[<p>Dominik_88 schrieb:</p>
<blockquote>
<p>Hat jemand von euch eine Idee?</p>
</blockquote>
<p>Du könntest hier fragen:<br />
<a href="http://www.c-plusplus.net/forum/viewforum-var-f-is-2.html" rel="nofollow">http://www.c-plusplus.net/forum/viewforum-var-f-is-2.html</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1951918</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1951918</guid><dc:creator><![CDATA[SeppJ]]></dc:creator><pubDate>Mon, 13 Sep 2010 11:09:32 GMT</pubDate></item><item><title><![CDATA[Reply to Zugriff von Variablen auf anderes Formular on Mon, 13 Sep 2010 11:30:36 GMT]]></title><description><![CDATA[<p>1. Forms, oder wie auch immer die Abtraktion für das jeweilige GUI Element heisst, sind nichts anderes als Objekte. Es geht also um <em>Kommunikation</em> zwischen Objekten.<br />
2. Genau ebendiese <em>Kommunikation</em> funktioniert indem das eine Objekt via Referenz (Pointer, Referenz) Zugriff auf das andere Objekt hat. Falls nötig über ein Interface getrennt. Der eigentlich Zugriff erfolgt dann via Methoden Aufrufe (unter die auch Getter / Setter fallen).</p>
<p>Simon</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1951926</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1951926</guid><dc:creator><![CDATA[theta]]></dc:creator><pubDate>Mon, 13 Sep 2010 11:30:36 GMT</pubDate></item></channel></rss>