How to get the data from edit control
-
Hi, I have used the following code to display the text in edit box and a combobox respectively. How can I get the data from these controls. CEdit *Display; Display = reinterpret_cast(GetDlgItem(IDC_EDITCAMPAIGNID)); Display->SetWindowText("tejaswini"); CComboBox *Combo; Combo = reinterpret_cast(GetDlgItem(IDC_COMBOFORMAT)); Combo->SetWindowText("shilpa"); Combo->AddString("Radhika"); Combo->AddString("Lakshmi"); But when i executed the program I am getting only "Lakshmi" in the dropdown list.How can I get "Radhika" also in the drop down list. Can u plz help me. Thanks in advance.
-
Hi, I have used the following code to display the text in edit box and a combobox respectively. How can I get the data from these controls. CEdit *Display; Display = reinterpret_cast(GetDlgItem(IDC_EDITCAMPAIGNID)); Display->SetWindowText("tejaswini"); CComboBox *Combo; Combo = reinterpret_cast(GetDlgItem(IDC_COMBOFORMAT)); Combo->SetWindowText("shilpa"); Combo->AddString("Radhika"); Combo->AddString("Lakshmi"); But when i executed the program I am getting only "Lakshmi" in the dropdown list.How can I get "Radhika" also in the drop down list. Can u plz help me. Thanks in advance.
GetWindowText
Bravoone
-
GetWindowText
Bravoone
Flaviu_2006 wrote:
Re: How to get the data from edit control
or if you have the id of the edit control and no variable associated to it... GetDlgItemText() or use SendMessage() etc...
Somethings seem HARD to do, until we know how to do them. ;-)_AnShUmAn_
-
Flaviu_2006 wrote:
Re: How to get the data from edit control
or if you have the id of the edit control and no variable associated to it... GetDlgItemText() or use SendMessage() etc...
Somethings seem HARD to do, until we know how to do them. ;-)_AnShUmAn_
ID of the edit control is IDC_EDITCAMPAIGNID Plz can you show the code fot it.
-
Hi, I have used the following code to display the text in edit box and a combobox respectively. How can I get the data from these controls. CEdit *Display; Display = reinterpret_cast(GetDlgItem(IDC_EDITCAMPAIGNID)); Display->SetWindowText("tejaswini"); CComboBox *Combo; Combo = reinterpret_cast(GetDlgItem(IDC_COMBOFORMAT)); Combo->SetWindowText("shilpa"); Combo->AddString("Radhika"); Combo->AddString("Lakshmi"); But when i executed the program I am getting only "Lakshmi" in the dropdown list.How can I get "Radhika" also in the drop down list. Can u plz help me. Thanks in advance.
tejaswini.g wrote:
Combo->AddString("Radhika"); Combo->AddString("Lakshmi"); But when i executed the program I am getting only "Lakshmi" in the dropdown list.How can I get "Radhika" also in the drop down list.
Are you sure, its not getting added?.I dont see any problem with code.
Prasad Notifier using ATL | Operator new[],delete[][^]
-
ID of the edit control is IDC_EDITCAMPAIGNID Plz can you show the code fot it.
tejaswini.g wrote:
Re: How to get the data from edit control
char *str=new char[10]; GetDlgItemText (IDC_EDITCAMPAIGNID,str,10); AfxMessageBox (str); // You have the data in str delete[] str;
Somethings seem HARD to do, until we know how to do them. ;-)_AnShUmAn_
-
tejaswini.g wrote:
Combo->AddString("Radhika"); Combo->AddString("Lakshmi"); But when i executed the program I am getting only "Lakshmi" in the dropdown list.How can I get "Radhika" also in the drop down list.
Are you sure, its not getting added?.I dont see any problem with code.
Prasad Notifier using ATL | Operator new[],delete[][^]
Sorry , In the properties I have selected NO integral height now and now I am getting the result. Thank you.
-
tejaswini.g wrote:
Re: How to get the data from edit control
char *str=new char[10]; GetDlgItemText (IDC_EDITCAMPAIGNID,str,10); AfxMessageBox (str); // You have the data in str delete[] str;
Somethings seem HARD to do, until we know how to do them. ;-)_AnShUmAn_
Thank you very much.
-
tejaswini.g wrote:
Re: How to get the data from edit control
char *str=new char[10]; GetDlgItemText (IDC_EDITCAMPAIGNID,str,10); AfxMessageBox (str); // You have the data in str delete[] str;
Somethings seem HARD to do, until we know how to do them. ;-)_AnShUmAn_
_AnShUmAn_ wrote:
char *str=new char[10];
Why suggest this when
CString
is preferable? Allocating memory is expensive. Unnecessarily interacting with the memory manager is just asking for trouble. Had you used aCEdit
member variable, one line of code would be all that's necessary.
"Talent without discipline is like an octopus on roller skates. There's plenty of movement, but you never know if it's going to be forward, backwards, or sideways." - H. Jackson Brown, Jr.
"Judge not by the eye but by the heart." - Native American Proverb
-
Thank you very much.
if you have a variable of CEdit you can use from it
m_Edit.GetWindowText(...);
if you have ID of control you can useGetDlgItemText
for text andGetDlgItemInt
for number:)_**
**_
WhiteSky