467,911 Members | 1,387 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,911 developers. It's quick & easy.

displaying text in an edit control.plzzzz help...

Hi all,
Am new to MFC appilcation programming.Plese tell me how to display a file with its path that is chosen from a file dialog.Am trying to create a dialog box displaying a list of files and when i click a file,its name with full path should be displayed in an edit control.plzzzz tell me how to do this.It is very urgent..

my code is as follows...


void CdiallDlg::OnBnClickedButton1()
{
CFile f1;
CFileDialog FileDlg(TRUE, NULL, NULL, 0,NULL,NULL);



if( FileDlg.DoModal() == IDOK )
{

temp=FileDlg.GetPathName();
/* i have declared this temp variable in the header file as CString temp.*/

}
m_text.SetString(temp);

}


my doubt:

i have declared this m_text variable in the edit control class wizard as CString.If i decare it as CEdit then i cannot assign it to temp....this is wat the problem is.Also if i declare temp as CEdit then wat is the function for setting a the selected file into the edit control?



plzzzzzzzz help me in this situation.This is very urgent.

thanks a lot...
Nov 9 '06 #1
  • viewed: 3232
Share:
5 Replies
sivadhas2006
100+
Hi,

I think this will satisfy your need.

Expand|Select|Wrap|Line Numbers
  1. SetWindowText(GetDlgItem(ID_OF_THE_EDIT_CONTROL), temp);
  2.  
Regards,
M.Sivadhas.
Nov 9 '06 #2
Add m_text as CEdit through class wizard and then use the following code.


m_text.SetWindowText(temp);



Hi all,
Am new to MFC appilcation programming.Plese tell me how to display a file with its path that is chosen from a file dialog.Am trying to create a dialog box displaying a list of files and when i click a file,its name with full path should be displayed in an edit control.plzzzz tell me how to do this.It is very urgent..

my code is as follows...


void CdiallDlg::OnBnClickedButton1()
{
CFile f1;
CFileDialog FileDlg(TRUE, NULL, NULL, 0,NULL,NULL);



if( FileDlg.DoModal() == IDOK )
{

temp=FileDlg.GetPathName();
/* i have declared this temp variable in the header file as CString temp.*/

}
m_text.SetString(temp);

}


my doubt:

i have declared this m_text variable in the edit control class wizard as CString.If i decare it as CEdit then i cannot assign it to temp....this is wat the problem is.Also if i declare temp as CEdit then wat is the function for setting a the selected file into the edit control?



plzzzzzzzz help me in this situation.This is very urgent.

thanks a lot...
Nov 9 '06 #3
thank you so much.It worked.
Nov 9 '06 #4
Thank you so much.I did it and it worked out.

regards,
shakthi
Nov 9 '06 #5
sivadhas2006
100+
Hi,

You are always welcome to http://www.thescripts.com.

Regards,
M.Sivadhas.
Nov 9 '06 #6

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

3 posts views Thread by Richard Carpenter | last post: by
11 posts views Thread by =?Utf-8?B?UmF5IE1pdGNoZWxs?= | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.