The ID exist....it is a Editbox of my Dialog
SetDlgItemText(IDC_E
Hello,
Zoppo I have a new question regarding the combobox with column.
--------------------------
How can I send a CString with SetDlgItemText to a Editbox in my Dialog.
in my virtual function SelectCurrentItem()' at my new class?
I always get an error that my program don´t know the resource ID.
500 points.
Best regards,
Thomas
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Hm - just tested it and in my case it works ok.
Do you still get error that the resource ID wasn't found? Or is it that just the text doesn't appear?
In the first case I can imagine two reasons why this doesn't work for you:
1. The edit box with ID 'IDC_EDIT_ADRESSE_RECHNUNG
2. The 'SelectCurrentItem' is called before the dialog is finally created.
If 1. is not the case (you have to know if it's wrong) I'd suggest to replace your call to 'SetDlgItemTest' with this code:
> CWnd* pParent = GetParent();
> if ( NULL != pParent )
> {
> CWnd* pEdit = pParent->GetDlgItem( IDC_EDIT_ADRESSE_RECHNUNG_
> if ( NULL != pEdit )
> {
> pEdit->SetItemText( "Just a try!" );
> }
> }
BTW: It shouldn't matter if you include the dialog's class header since this functionality simply acts on the control's windows, so only the control ID has to be known at this place ...
ZOPPO
sorry...but still the same
Do you still get error that the resource ID wasn't found? Or is it that just the text doesn't appear?.....the resource ID is not found
also I got a new error
'SetItemText': Is no Element of 'CWnd'
2. The 'SelectCurrentItem' is called before the dialog is finally created.
No....the dialog with my Editbox is there
Sorry, it's 'SetWindowText', not 'SetItemText' ...
Do you use something like a child dialog as parent for either the combo box or the edit control?
Can you check if the edit control and the combo box have the same parent window (the dialog) and the resource ID of the edit box really is IDC_EDIT_ADRESSE_RECHNUNG_
ZOPPO
.......Can you check if the edit control and the combo box have the same parent window (the dialog) and the resource ID of the edit box really is IDC_EDIT_ADRESSE_RECHNUNG_
Good Morning Zoppo,
I don´t know where to find and how to use the Spy++? Please advise.
My Visual Studio is 2003 Version 7.1.6030 Net Framework 1.1
Hi,
unfortunateley I can't exactly say where Spy++ is in VS 2003 - in VS 2005 and VS 2008 you can find it in the start menu 'Microsoft Visual Studio 2008->Visual Studio Tools'.
To find out the thing I asked you should comment out the code which makes problems so you can open the dialog without error, then in Spy++ you can use 'Search->Find Window' to get information about the both controls, i.e. see if they have the same parent and see the value of the 'Control-ID' of the edit control so you can compare it with the value defined for 'IDC_EDIT_ADRESSE_RECHNUNG
ZOPPO
ok, so far so good - easiest to find this out is to do following:
- start you application and open the dialog in question
- start Spy++ and select 'Search -> Find Window' (as shown in your second screenshot)
- Take the small cross hair at the right side of 'Suchtool:' with the mouse and drop it above the edit control 'IDC_EDIT_ADRESSE_RECHNUNG
- Now in the main window of Spy++ an entry containing info about that edit control should be selected - right click it and select 'Properties', then you should be able to see the 'Control ID' of the edit control in the up coming properties window's first tab.
- Next do the same (Search -> Find Window) and select the combo box in question - check that it has the same parent node as the edit control has.
ZOPPO
if we stuck here.....can I not call a function in Geschaeftsadressen.cpp
to add the CString that I will set to IDC_EDIT_ADRESSE_RECHNUNG_
void CMulti_Column_ComboBox_NEU
{
int nIndex = GetCurrentItem();
CString strText;
CListCtrl* pList = GetListCtrl();
//------------------------
if(NULL !=pList && nIndex >=0)
{
strText.Format("%s, %s, %s, %s", pList->GetItemText(nIndex,1
pList->GetItemText(nIndex,2
pList->GetItemText(nIndex,3
pList->GetItemText(nIndex,6
}
//------------------------
GetEdit()->SetWindowText(st
CGeschaeftsadressen::Get_A
}
CGeschaeftsadressen::Get_A
==========================
but that will not work....I also got an error when I enclose Geschaeftsadressen.h
ok, still strange - IMO it should work - we now verified the edit control has the correct ID and is a sibling control of the combo box, so this code should in general work:
> void CMulti_Column_ComboBox_NEU
> {
>
> ... // other stuff
>
> CWnd* pParent = GetParent();
> ASSERT( NULL != pParent );
> if ( NULL != pParent )
> {
> CWnd* pEdit = pParent->GetDlgItem( IDC_EDIT_ADRESSE_RECHNUNG_
> ASSERT( NULL != pEdit );
> if ( NULL != pEdit )
> {
> pEdit->SetWindowText( "Just a try!" );
> }
> }
>> can I not call a function in Geschaeftsadressen.cpp
That's just what we try here - with 'GetParent' you should get a pointer to the parent dialog (which should be a 'CGeschaeftsadressen' instance). With 'GetDlgItem' we try to achieve a pointer to a CWnd representating the edit control with the ID 'IDC_EDIT_ADRESSE_RECHNUNG
IMO this is quite strait forward - I did such thing hundreds of times without problems - but it's hard to say what's going wrong within your code without seeing it completely and without the possibility to debug it ...
Regards,
ZOPPO
I did exactly the same - I have a multi column combo box with three columns and a edit control within a dialog.
Attached you can see the 'SelectCurrentItem' I use - it works like a charm. IMO anything about the multi column combo box (ID, subclass a.s.o.) shouldn't matter, as long as the correct 'SelectCurrentItem' is called it should be possible from there to set the edit control's text.
ZOPPO
//########################
void CMainFrame::OnGeschLiefera
{
CGeschaeftsadressen *pMeinDialog;
pMeinDialog = new CGeschaeftsadressen( AfxGetMainWnd(), 1 );
//pMeinDialog = new CGeschaeftsadressen;
pMeinDialog->mb_Kennzahl_fi
pMeinDialog->ShowWindow(SW_
//hier die Steuerung/Übergabe von Wert 1 an Geschäftsadressen
//Dialog nSteuerung bzw. m_Kennzahl_komme_von_CMain
}
//########################
or does that have something to do with it.....this is the way I call CGeschaeftsadressen Dialog from CMainFrame??? I am fishing....
I don't think this should affect what happens within the dialog - just for testing you could change implementation to use the dialog as a modal one, i.e. add these lines at the beginning of that function:
> CGeschaeftsadressen dlg;
> dlg.DoModal();
> return;
I don't think this makes a difference, but who knows - after testing you can delete these lines again.
BTW: Could you please post again the current version of the 'SelectCurrentItem' you use?
ZOPPO
//########################
void CMulti_Column_ComboBox_NEU
{
int nIndex = GetCurrentItem();
CString strText;
CListCtrl* pList = GetListCtrl();
//------------------------
if(NULL !=pList && nIndex >=0)
{
strText.Format("%s, %s, %s, %s", pList->GetItemText(nIndex,1
pList->GetItemText(nIndex,2
pList->GetItemText(nIndex,3
pList->GetItemText(nIndex,6
}
//------------------------
GetEdit()->SetWindowText(st
//MemberVariable
//m_strAuswahl=strText;
//this is the original code
// if (nIndex >= 0)
// if (CWnd* pParent = GetParent())
// pParent->SendMessage(m_nSel
//------------------------
/*
CWnd* pParent = GetParent();
if ( NULL != pParent )
{
CWnd* pEdit = pParent->GetDlgItem( IDC_EDIT_ADRESSE_RECHNUNG_
if ( NULL != pEdit )
{
pEdit->SetWindowText( "Just a try!" );
}
}
CWnd* pParent = GetParent();
ASSERT( NULL != pParent );
if ( NULL != pParent )
{
CWnd* pEdit = pParent->GetDlgItem( IDC_EDIT_ADRESSE_RECHNUNG_
ASSERT( NULL != pEdit );
if ( NULL != pEdit )
{
pEdit->SetWindowText( "Just a try!" );
}
}
GetParent()->SetDlgItemText
*/
//------------------------
}
//########################
I changed my project to debug modus.....
When I put here a breakpoint
SelectCurrentItem(void)
Get
but it will not stop
CWnd* pParent = GetParent();
ASSERT( NULL != pParent );..... see bitmap breakpoint with ?
When I start the debug ..... I got the error with the ID.....when I then press continue.....
the program runs.....but no effect of the GetParent code
So you mean your project doesn't compile in DEBUG configuration? That's not good ... I guess that the breakpoints aren't hit because the build failed so the previously built EXE is executed which has no relation to the changed code - you should try to resolve the compile errors in DEBUG configuration ...
Well, since I find it's quite difficult to solve this problem without a chance to test it I want to ask you if you either could attach your project here within a ZIP file (if it's not too large or too secret) or if you could try to make a small new test project with just one dialog, one multi colum combo box (which should use your current CMulti_Column_ComboBox_NEU
ZOPPO
Hello Zoppo,
thanks for your offer. The thing is that today is my last day before my vacation.
I am going on vacation tomorrow for 2 1/2 weeks.
I give you the points....even if we didn´t find a solution. I try to send you a text object....but I don´t know if I have enough time....because of my last day before vacation and I am in my office....had have some work to do.
If not....I will ask the question in mid. Nov. again.
Best regards,
Thomas
okay...great....I forgot that I have a sample of the program just on Dialog.....
I just added a Editbox.....same result as my main program....can not find ID
I just tried to add my zip....but this site will not allow my files
The extension of one or more files in the archive is not in the list of allowed extensions: ComboBox_with_Column.cpp
Hi again,
seems you enjoyed your vacancy ...
Well, I'm a little bit off-topic, but as far as I can see this are the same steps I did - and for me it works.
Just to clearify: This sample does compile well but no text appears in the edit box, right?
Are you now able to build that application as a DEBUG build? If so you should debug through the CComboBoxNEU::SelectCurren
ZOPPO
ok, this means the project doesn't compile, the reason is 'error C2065: 'IDC_EDIT1': nichtdeklarierter Bezeichner'
IMO the problem is that 'resource.h' isn't included in ComboBoxNEU.cpp - just add this line
> #include "resource.h"
somewhere below the line
> #include "stdafx.h"
(somehow like in the attached code)
I hope this helps,
ZOPPO
wow....wow...wow....what a simple mistake....now it works !!!!!!!
That was a long try and error, thank you so much.
Great work Zoppo.
Thanks for all your help.
Best regards....keep up the good work
Thomas
P.S. after I left you points in a minute....I have a new question.....it kind of belongs to the combobox....Please take a look....I hope you can help me.
Business Accounts
Answer for Membership
by: ZoppoPosted on 2009-10-26 at 06:51:51ID: 25662203
Hi tsp2002,
could you post the 'SelectCurrentItem' as you use it now?
I guess the ID you pass to SetDlgItemText doesn't exist? Is it the edit box of the multi-column combo box or any other edit box in the dialog?
ZOPPO