<?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[CComboBox und CString nach int bei VC++2005]]></title><description><![CDATA[<p>Hallo,</p>
<p>ich habe im Resourcen-Editor einen Dialog mit einer Combobox drauf die ich mit mehreren Strings fülle. In der Vorschau werden mir alle Strings wunderbar angezeigt, aber wenn ich das Programm compiliert habe, dann sehe ich nicht einen String drinne. Habe auch versucht bei OnInitDialog das ganze mit</p>
<pre><code class="language-cpp">...
m_ctrlComb.AddString(_T(&quot;Einfach&quot;));
m_ctrlComb.AddString(_T(&quot;Zweifach&quot;));
m_ctrlCpmb.AddString(_T(&quot;Dreifach&quot;));	
...
</code></pre>
<p>zu füllen aber das klappt auch nicht. Weis da jemand Rat ?</p>
<p>Und noch was wenn ich einen String nach int mit atoi(str) konvertieren will, dann zeigt er mir folgende Fehlermeldung an:</p>
<pre><code class="language-cpp">error C2664: 'atoi': Konvertierung des Parameters 1 von 'CString' in 'const char *' nicht möglich
</code></pre>
<p>Weis jemand auch hier Rat ?</p>
<p>Dank Euch schon mal.</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/162756/ccombobox-und-cstring-nach-int-bei-vc-2005</link><generator>RSS for Node</generator><lastBuildDate>Thu, 30 Jul 2026 06:12:02 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/162756.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 23 Oct 2006 01:33:11 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to CComboBox und CString nach int bei VC++2005 on Mon, 23 Oct 2006 01:33:11 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>ich habe im Resourcen-Editor einen Dialog mit einer Combobox drauf die ich mit mehreren Strings fülle. In der Vorschau werden mir alle Strings wunderbar angezeigt, aber wenn ich das Programm compiliert habe, dann sehe ich nicht einen String drinne. Habe auch versucht bei OnInitDialog das ganze mit</p>
<pre><code class="language-cpp">...
m_ctrlComb.AddString(_T(&quot;Einfach&quot;));
m_ctrlComb.AddString(_T(&quot;Zweifach&quot;));
m_ctrlCpmb.AddString(_T(&quot;Dreifach&quot;));	
...
</code></pre>
<p>zu füllen aber das klappt auch nicht. Weis da jemand Rat ?</p>
<p>Und noch was wenn ich einen String nach int mit atoi(str) konvertieren will, dann zeigt er mir folgende Fehlermeldung an:</p>
<pre><code class="language-cpp">error C2664: 'atoi': Konvertierung des Parameters 1 von 'CString' in 'const char *' nicht möglich
</code></pre>
<p>Weis jemand auch hier Rat ?</p>
<p>Dank Euch schon mal.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1159265</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1159265</guid><dc:creator><![CDATA[mike2003]]></dc:creator><pubDate>Mon, 23 Oct 2006 01:33:11 GMT</pubDate></item><item><title><![CDATA[Reply to CComboBox und CString nach int bei VC++2005 on Mon, 23 Oct 2006 09:06:19 GMT]]></title><description><![CDATA[<p>Ist das hier eins deiner Probleme ?<br />
<a href="http://www.c-plusplus.net/forum/viewtopic-var-t-is-39108.html" rel="nofollow">http://www.c-plusplus.net/forum/viewtopic-var-t-is-39108.html</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1159326</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1159326</guid><dc:creator><![CDATA[isabeau]]></dc:creator><pubDate>Mon, 23 Oct 2006 09:06:19 GMT</pubDate></item><item><title><![CDATA[Reply to CComboBox und CString nach int bei VC++2005 on Mon, 23 Oct 2006 09:09:16 GMT]]></title><description><![CDATA[<p>Wo ist in Deinem Code die stelle mit &quot;atoi&quot;?<br />
Und verwende anstelle von atoi bitte &quot;_tstoi&quot; (TCHAR-Version!).</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1159336</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1159336</guid><dc:creator><![CDATA[Jochen Kalmbach]]></dc:creator><pubDate>Mon, 23 Oct 2006 09:09:16 GMT</pubDate></item><item><title><![CDATA[Reply to CComboBox und CString nach int bei VC++2005 on Mon, 23 Oct 2006 10:57:56 GMT]]></title><description><![CDATA[<p>Es ist übrigens einfacher die Daten/Werte diezu einem Eintrag gehören mit SetItemData abzulegen.<br />
Also AddString durchführen, den index nutzen und SetItemData aufrufen. Dann kannst Du einfach die selektierten Daten per GetItemData abfragen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1159419</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1159419</guid><dc:creator><![CDATA[Martin Richter]]></dc:creator><pubDate>Mon, 23 Oct 2006 10:57:56 GMT</pubDate></item><item><title><![CDATA[Reply to CComboBox und CString nach int bei VC++2005 on Mon, 23 Oct 2006 14:31:06 GMT]]></title><description><![CDATA[<p>Hallo Leute und Danke für die Hilfen erstmals.<br />
Also das mit dem CString nach int funzt jetzt mit:</p>
<pre><code class="language-cpp">CString str = &quot;120&quot;;
int a = _tstoi(str);
</code></pre>
<p>aber das Problem mit der ComboBox ist noch nicht behoben. Kann mir da jemand vieleicht ein Beispiel posten so wie z.B. das folgende ? Ich habe dort immer noch das Problem das gleich beim ersten Eintrag das Programm abbricht. Vorweg schon mal die Liste ist im Resourcen-Editor groß genug.</p>
<pre><code class="language-cpp">CComboBox* pComb = new CComboBox();
pComb-&gt;AddString(_T(&quot;1&quot;));  // Hier erfolgt schon der Abbruch
pComb-&gt;AddString(_T(&quot;2&quot;));
pComb-&gt;SetItemData(0,2);
</code></pre>
<p>Danke schon mal</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1159637</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1159637</guid><dc:creator><![CDATA[mike2003]]></dc:creator><pubDate>Mon, 23 Oct 2006 14:31:06 GMT</pubDate></item><item><title><![CDATA[Reply to CComboBox und CString nach int bei VC++2005 on Mon, 23 Oct 2006 15:38:55 GMT]]></title><description><![CDATA[<p>in der MSDN stehts ohne new</p>
<pre><code class="language-cpp">CComboBox* pmyComboBox;
CString str=_T(&quot;&quot;);
for (int i=0;i &lt; 20;i++){
   str.Format(_T(&quot;item string %d&quot;), i);
   pmyComboBox-&gt;AddString(str);
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1159713</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1159713</guid><dc:creator><![CDATA[EXDW]]></dc:creator><pubDate>Mon, 23 Oct 2006 15:38:55 GMT</pubDate></item><item><title><![CDATA[Reply to CComboBox und CString nach int bei VC++2005 on Mon, 23 Oct 2006 21:18:51 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">CComboBox* pmyComboBox;
CString str=_T(&quot;&quot;);
for (int i=0;i &lt; 20;i++){
   str.Format(_T(&quot;item string %d&quot;), i);
   pmyComboBox-&gt;AddString(str);
}
</code></pre>
<p>Hallo,<br />
so habe ich das auch probiert aber bekomme eine Fehlermeldung das die Variable pmyComboBox benutzt wird ohne vorher initialisiert zu werden.</p>
<p>Dann habe ich mit CComboBox* pmyComboBox = new CComboBox(); die Variable initialisiert und trotzdem stürzt das Programm bei AddString ab. Erbitte um weitere Hilfe.</p>
<p>Danke</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1159962</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1159962</guid><dc:creator><![CDATA[mike2003]]></dc:creator><pubDate>Mon, 23 Oct 2006 21:18:51 GMT</pubDate></item><item><title><![CDATA[Reply to CComboBox und CString nach int bei VC++2005 on Mon, 23 Oct 2006 21:38:31 GMT]]></title><description><![CDATA[<p>Also entweder fügst du zu einem ComboBox-Element ein Steuerelement als Membervariable hinzu und kontrollierst die Combobox dann über diese Variable, oder du erstellst die Box dynamisch, dazu musst du aber vorher Create aufrufen.</p>
<p>Ich schlage zudem mal vor, dass du dir ein Tutorial zur MFC durcharbeitest. Ein Beispiel wäre dieses hier:<br />
<a href="http://www.henkessoft.de/C++/MFC/MFC%20Tutorials.htm" rel="nofollow">http://www.henkessoft.de/C++/MFC/MFC Tutorials.htm</a></p>
<p>Grüssli</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1159970</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1159970</guid><dc:creator><![CDATA[Dravere]]></dc:creator><pubDate>Mon, 23 Oct 2006 21:38:31 GMT</pubDate></item><item><title><![CDATA[Reply to CComboBox und CString nach int bei VC++2005 on Mon, 23 Oct 2006 23:11:44 GMT]]></title><description><![CDATA[<p>Hallo,<br />
das beste was ich jetzt herausgefunden habe ist gar nicht erst mit irgendwelchen Variablen zu arbeiten wenn man nur temporär Daten zwischen Fenstern(z.B. Buttons, Editfelder) hin und herschieben will, sondern mit den API-Funktionen z.B. so:</p>
<pre><code class="language-cpp">CComboBox* pCombo = (CComboBox*)GetDlgItem(IDC_COMBOF);
pCombo-&gt;AddString(_T(&quot;erster&quot;));
pCombo-&gt;AddString(_T(&quot;zweiter&quot;));
pCombo-&gt;SetCurSel(0);
...
</code></pre>
<p>funzt wunderbar und zeigt auch die Werte nach dem compilieren an (Debug- oder Release-Vers. egal).</p>
<p>Oder wenn man die Schrift ändern will:</p>
<pre><code class="language-cpp">CWnd* pWnd = GetDlgItem(IDC_PREVSHOW);
pWnd-&gt;SetFont(m_NewFont);        // Pointer auf m_NewFont
pWnd-&gt;SetWindowText(m_strFont);  // CString
</code></pre>
<p>funzt auch wunderbar und finde auch den Zugriff auf die Fenster viel besser. Ausserdem spart man lästige Variablen und bläht nicht unnötig seinen Code auf.</p>
<p>Wenn einer eine bessere Alternative kennt bitte posten.</p>
<p>LG</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1159993</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1159993</guid><dc:creator><![CDATA[mike2003]]></dc:creator><pubDate>Mon, 23 Oct 2006 23:11:44 GMT</pubDate></item></channel></rss>