<?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[switch]]></title><description><![CDATA[<p>Hallo, Leute. Brauche Ihre Hilfe. Also, ein ComboBox. Man wählt einen Wort<br />
aus ComboBox1.Dann klickt auf Button und in ComboBox2 wirt geladen<br />
entsprechende Liste.Bei mir kommt immer Fehler. So mache ich dass:</p>
<pre><code>UpdateData(TRUE);
CString m_sComboBox1; //Value-Variable CComboBox1
switch(m_sComboBox1)
{
case &quot;Wort_1&quot;:
bla-bla-bla;
break;
case &quot;Wort_2&quot;:
bla-bla-bla-;
break;
...
}
</code></pre>
<p>Und bekomme Fehlermeldung:</p>
<pre><code>error C2450: switch expression of type 'CString' is illegal
error C2051: case expression not constant
</code></pre>
<p>Ich danke voraus.</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/74141/switch</link><generator>RSS for Node</generator><lastBuildDate>Sun, 26 Apr 2026 15:40:11 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/74141.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 17 May 2004 16:49:55 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to switch on Mon, 17 May 2004 16:49:55 GMT]]></title><description><![CDATA[<p>Hallo, Leute. Brauche Ihre Hilfe. Also, ein ComboBox. Man wählt einen Wort<br />
aus ComboBox1.Dann klickt auf Button und in ComboBox2 wirt geladen<br />
entsprechende Liste.Bei mir kommt immer Fehler. So mache ich dass:</p>
<pre><code>UpdateData(TRUE);
CString m_sComboBox1; //Value-Variable CComboBox1
switch(m_sComboBox1)
{
case &quot;Wort_1&quot;:
bla-bla-bla;
break;
case &quot;Wort_2&quot;:
bla-bla-bla-;
break;
...
}
</code></pre>
<p>Und bekomme Fehlermeldung:</p>
<pre><code>error C2450: switch expression of type 'CString' is illegal
error C2051: case expression not constant
</code></pre>
<p>Ich danke voraus.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/522118</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/522118</guid><dc:creator><![CDATA[Anin]]></dc:creator><pubDate>Mon, 17 May 2004 16:49:55 GMT</pubDate></item><item><title><![CDATA[Reply to switch on Mon, 17 May 2004 17:00:39 GMT]]></title><description><![CDATA[<p>Sagt die Fehlermeldung ja schon.</p>
<p>Man kann switch keinen CString geben.</p>
<p>versuche es z.B. mit einer</p>
<p>if(m_sComboBox1 == &quot;Wort_1&quot;)<br />
{<br />
}</p>
<p>if(m_sComboBox1 == &quot;Wort_2&quot;)<br />
{<br />
}</p>
<p>Es gibt sicher noch bessere Lösungen aber da müsste man mal dein Gesamtkonzept kennen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/522133</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/522133</guid><dc:creator><![CDATA[Unix-Tom]]></dc:creator><pubDate>Mon, 17 May 2004 17:00:39 GMT</pubDate></item><item><title><![CDATA[Reply to switch on Mon, 17 May 2004 18:34:23 GMT]]></title><description><![CDATA[<p>hmmm</p>
<p>ausser die liste hat die gleiche reihenfolge<br />
dann kannst du ja die zeilenposition nehmen<br />
und dann switch machen<br />
sprich in der liste in ganz oben<br />
dann switch case 0<br />
usw</p>
<p>oder du machst define z.b.<br />
define wort_1 = 0<br />
wort_2 = 1<br />
und dann switch</p>
<p>es gibt viele möglichkeiten</p>
<p>PS sag was du nimmst</p>
]]></description><link>https://www.c-plusplus.net/forum/post/522212</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/522212</guid><dc:creator><![CDATA[newkid]]></dc:creator><pubDate>Mon, 17 May 2004 18:34:23 GMT</pubDate></item><item><title><![CDATA[Reply to switch on Tue, 18 May 2004 05:38:45 GMT]]></title><description><![CDATA[<p>Es ist sowieso *die* Regel, sich niemals auf UI-Strings zu verlassen. was passiert, wenn z.B. jemand deine Anwendung nach türkisch portiert?</p>
<p>Für Comboboxes heißt das: jedem String mit SetItemData einen ID zuordnen - und über den kannst du dann switchen (aber das ist nurein netter Nebeneffekt).</p>
]]></description><link>https://www.c-plusplus.net/forum/post/522416</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/522416</guid><dc:creator><![CDATA[peterchen]]></dc:creator><pubDate>Tue, 18 May 2004 05:38:45 GMT</pubDate></item><item><title><![CDATA[Reply to switch on Tue, 18 May 2004 12:37:51 GMT]]></title><description><![CDATA[<p>Also, da bin ich wieder. Ich habe probiert mit GetItemData, kommt aber Warning:</p>
<pre><code>Debug Assertion Failed!
</code></pre>
<p>Da ist Code:</p>
<pre><code>...
int i, iWahl;
for(i=0; i &lt;= m_ctlCombo.GetCount(); i++)
{
iWahl = m_ctlCombo.GetItemData(i);

switch(iWahl)
{					
case 0:
...
MessageBox((LPCTSTR)iWahl, &quot;&quot;, MB_OK); //Überprüfen, ob kommt überhaupt was heraus
break;
case 1:
...
MessageBox((LPCTSTR)iWahl, &quot;&quot;, MB_OK); //Überprüfen, ob kommt überhaupt was heraus
...
}
}
</code></pre>
<p>Und MessageBox kommt immer leer. Was soll ich jetzt tun?<br />
Ich danke voraus.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/522639</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/522639</guid><dc:creator><![CDATA[Anin]]></dc:creator><pubDate>Tue, 18 May 2004 12:37:51 GMT</pubDate></item><item><title><![CDATA[Reply to switch on Tue, 18 May 2004 14:56:58 GMT]]></title><description><![CDATA[<p>Du kannst nen int nicht einfach &quot;blind&quot; nach LPCTSTR casten ... atof, CString::Format oder ähnliches.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/522770</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/522770</guid><dc:creator><![CDATA[peterchen]]></dc:creator><pubDate>Tue, 18 May 2004 14:56:58 GMT</pubDate></item><item><title><![CDATA[Reply to switch on Tue, 18 May 2004 16:05:18 GMT]]></title><description><![CDATA[<p>Kannst du mir zeigen, wie<br />
konvertiert man einen Integer nach LPCTSTR ?<br />
Und eigentlich, dass ist nicht so wichtig.<br />
Trotzdem in zweite ComboBox kommt immer die gleiche.<br />
MessageBox ist hier nur für Überprüfung.</p>
<pre><code>Also, ein ComboBox. Man wählt einen Wort 
aus ComboBox1.Dann klickt auf Button und in ComboBox2 wirt geladen 
entsprechende Liste
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/522826</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/522826</guid><dc:creator><![CDATA[Anin]]></dc:creator><pubDate>Tue, 18 May 2004 16:05:18 GMT</pubDate></item><item><title><![CDATA[Reply to switch on Tue, 18 May 2004 16:15:21 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">CString IntToCString(int iVal){CString sStr; sStr.Format(&quot;%d&quot;,iVal);return sStr);

MessageBox(IntToCString(iWahl), &quot;&quot;, MB_OK);
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/522835</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/522835</guid><dc:creator><![CDATA[Sovok]]></dc:creator><pubDate>Tue, 18 May 2004 16:15:21 GMT</pubDate></item><item><title><![CDATA[Reply to switch on Tue, 18 May 2004 16:43:37 GMT]]></title><description><![CDATA[<p>Also, jetzt mein MessageBox funktioniert.<br />
Und es zeigt, das Problemm wie frühe liegt in<br />
for oder switch. Ich denke in for, weil<br />
MessageBox zeigt immer 0.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/522853</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/522853</guid><dc:creator><![CDATA[Anin]]></dc:creator><pubDate>Tue, 18 May 2004 16:43:37 GMT</pubDate></item><item><title><![CDATA[Reply to switch on Wed, 19 May 2004 07:55:00 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">wann rufst du CComboBox::SetItemData auf?

/*
 * Combo Box return Values
 */
#define CB_OKAY             0
#define CB_ERR              (-1)
#define CB_ERRSPACE         (-2)
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/523161</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/523161</guid><dc:creator><![CDATA[Sovok]]></dc:creator><pubDate>Wed, 19 May 2004 07:55:00 GMT</pubDate></item><item><title><![CDATA[Reply to switch on Wed, 19 May 2004 10:34:12 GMT]]></title><description><![CDATA[<p>Jetzt alles funktioniert. Mit GetCurSel().<br />
Danke für alles. <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f603.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--grinning_face_with_big_eyes"
      title=":D"
      alt="😃"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/523318</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/523318</guid><dc:creator><![CDATA[Anin]]></dc:creator><pubDate>Wed, 19 May 2004 10:34:12 GMT</pubDate></item></channel></rss>