File extension validation
-
Hi, iam developing a dailog based application in Wizard mode. i need to validate the file which the user is entering. so i need to validate the file extension.if the extension is wrong i need to pop a message saying wrong file. How can i validate the file extension. Regards Harish.
-
Hi, iam developing a dailog based application in Wizard mode. i need to validate the file which the user is entering. so i need to validate the file extension.if the extension is wrong i need to pop a message saying wrong file. How can i validate the file extension. Regards Harish.
Did you used
CFileDialog
_**
**_
WhiteSky
-
Hi, iam developing a dailog based application in Wizard mode. i need to validate the file which the user is entering. so i need to validate the file extension.if the extension is wrong i need to pop a message saying wrong file. How can i validate the file extension. Regards Harish.
Again ?? How many times did you already post your question ? What was wrong with the previous suggestions ? Did you look at CFileDialog ?
Cédric Moonen Software developer
Charting control [Updated - v1.1] -
Again ?? How many times did you already post your question ? What was wrong with the previous suggestions ? Did you look at CFileDialog ?
Cédric Moonen Software developer
Charting control [Updated - v1.1]I have checked the earlier reply. As iam in learing curve i am not able to implement that exactly
-
Hi, iam developing a dailog based application in Wizard mode. i need to validate the file which the user is entering. so i need to validate the file extension.if the extension is wrong i need to pop a message saying wrong file. How can i validate the file extension. Regards Harish.
Here's a code for you using CFileDialog
CFileDialog *pDlg=new CFileDialog(true); if(pDlg->DoModal ()==IDOK) { CString str=pDlg->GetFileExt (); if(!str.CompareNoCase ("txt")) // Compare returns 0 if successful AfxMessageBox ("Text File Selected"); else AfxMessageBox ("Select text files only"); }
Hope this helps you...
Somethings seem HARD to do, until we know how to do them. ;-)_AnShUmAn_
-
Here's a code for you using CFileDialog
CFileDialog *pDlg=new CFileDialog(true); if(pDlg->DoModal ()==IDOK) { CString str=pDlg->GetFileExt (); if(!str.CompareNoCase ("txt")) // Compare returns 0 if successful AfxMessageBox ("Text File Selected"); else AfxMessageBox ("Select text files only"); }
Hope this helps you...
Somethings seem HARD to do, until we know how to do them. ;-)_AnShUmAn_
Thanks for ur reply. but i have a small issue. iam using edit box in the dailog box.user enters the file in that edit box. how to validate that.
-
Thanks for ur reply. but i have a small issue. iam using edit box in the dailog box.user enters the file in that edit box. how to validate that.
reddy harish wrote:
user enters the file in that edit box.
you can use CString::Find() If you find the extension that you specified in the Find method you would get the index from where the extension starts. You can use this and validify the file extension.... You can also extract the file extension from the string and then use it for validation.(See as I did in my previous post) There could be some other possible ways also...
Somethings seem HARD to do, until we know how to do them. ;-)_AnShUmAn_
-
Hi, iam developing a dailog based application in Wizard mode. i need to validate the file which the user is entering. so i need to validate the file extension.if the extension is wrong i need to pop a message saying wrong file. How can i validate the file extension. Regards Harish.
reddy harish wrote:
i need to validate the file which the user is entering.
Validate it for what?
reddy harish wrote:
if the extension is wrong...
Wrong in what context?
"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