Reputation: 121
I want a browse option button into my form application which should browse the file till the path and get the only file name(which has been selected) into a text box.
Please reply..
Thanks, Amrita
Upvotes: 0
Views: 4889
Reputation: 4663
Add a button to your form and then on click of the button write this code with appropriate filter and extension of file which you want to open. Read this
static char szFilter[] =
"Chart Files (*.xlc)|*.xlc|Worksheet Files (*.xls)|*.xls|All Files (*.*)|*.*||";
CFileDialog FileDlg(TRUE, ".xls", NULL, 0, szFilter);
if( FileDlg.DoModal() == IDOK ) {
CString strFile = FileDlg.GetFileName();
...
}
Upvotes: 4