Edit Box
-
Hi, I have 2 edit box in my dialog m_INDEX_FILE & m_WORD & a Search button. on the OnSearch()i want to check if the user has entered data or not if the user has not entered data then i want to disply a message box for that i have used below code. but the problem is below code has no effect ...can u please tell what changes has to be made.... void CSearchDlg::OnSearch() { UpdateData(TRUE); if (m_INDEX_FILE.GetLength() < 0 ) { MessageBox("Select the Index File before searching !","Asis Search Engine",MB_OK | MB_ICONINFORMATION); return; } if (m_WORD.GetLength() < 0 ) { MessageBox("Enter the word to be searched","Asis Search Engine",MB_OK | MB_ICONINFORMATION); return; } } Regards, Vinay Charan.
-
Hi, I have 2 edit box in my dialog m_INDEX_FILE & m_WORD & a Search button. on the OnSearch()i want to check if the user has entered data or not if the user has not entered data then i want to disply a message box for that i have used below code. but the problem is below code has no effect ...can u please tell what changes has to be made.... void CSearchDlg::OnSearch() { UpdateData(TRUE); if (m_INDEX_FILE.GetLength() < 0 ) { MessageBox("Select the Index File before searching !","Asis Search Engine",MB_OK | MB_ICONINFORMATION); return; } if (m_WORD.GetLength() < 0 ) { MessageBox("Enter the word to be searched","Asis Search Engine",MB_OK | MB_ICONINFORMATION); return; } } Regards, Vinay Charan.
what is m_INDEX_FILE ?CString and m_WORD_**
**_
whitesky
-
Hi, I have 2 edit box in my dialog m_INDEX_FILE & m_WORD & a Search button. on the OnSearch()i want to check if the user has entered data or not if the user has not entered data then i want to disply a message box for that i have used below code. but the problem is below code has no effect ...can u please tell what changes has to be made.... void CSearchDlg::OnSearch() { UpdateData(TRUE); if (m_INDEX_FILE.GetLength() < 0 ) { MessageBox("Select the Index File before searching !","Asis Search Engine",MB_OK | MB_ICONINFORMATION); return; } if (m_WORD.GetLength() < 0 ) { MessageBox("Enter the word to be searched","Asis Search Engine",MB_OK | MB_ICONINFORMATION); return; } } Regards, Vinay Charan.
-
Hi, I have 2 edit box in my dialog m_INDEX_FILE & m_WORD & a Search button. on the OnSearch()i want to check if the user has entered data or not if the user has not entered data then i want to disply a message box for that i have used below code. but the problem is below code has no effect ...can u please tell what changes has to be made.... void CSearchDlg::OnSearch() { UpdateData(TRUE); if (m_INDEX_FILE.GetLength() < 0 ) { MessageBox("Select the Index File before searching !","Asis Search Engine",MB_OK | MB_ICONINFORMATION); return; } if (m_WORD.GetLength() < 0 ) { MessageBox("Enter the word to be searched","Asis Search Engine",MB_OK | MB_ICONINFORMATION); return; } } Regards, Vinay Charan.
void CAnswerDlg::OnBnClickedMybutton() { CString str; m_Edit1.GetWindowText(str); if(str.IsEmpty()) MessageBox("Empty"); else MessageBox("not"); }
_**
**_
whitesky
-
Hi, I have 2 edit box in my dialog m_INDEX_FILE & m_WORD & a Search button. on the OnSearch()i want to check if the user has entered data or not if the user has not entered data then i want to disply a message box for that i have used below code. but the problem is below code has no effect ...can u please tell what changes has to be made.... void CSearchDlg::OnSearch() { UpdateData(TRUE); if (m_INDEX_FILE.GetLength() < 0 ) { MessageBox("Select the Index File before searching !","Asis Search Engine",MB_OK | MB_ICONINFORMATION); return; } if (m_WORD.GetLength() < 0 ) { MessageBox("Enter the word to be searched","Asis Search Engine",MB_OK | MB_ICONINFORMATION); return; } } Regards, Vinay Charan.
Hi , Instead of UpdateData() try using GetWindowText():
void CSearchDlg::OnSearch()
{
CString szCaption;
m_INDEX_FILE.GetWindowText(szCaption); // m_INDEX_FILE is your CEdit member
if (!szCaption.IsEmpty())
MessageBox("Select the Index File before searching !","Asis Search Engine",MB_OK | MB_ICONINFORMATION);
return;
}Regards, Eli
-
Hi, I have 2 edit box in my dialog m_INDEX_FILE & m_WORD & a Search button. on the OnSearch()i want to check if the user has entered data or not if the user has not entered data then i want to disply a message box for that i have used below code. but the problem is below code has no effect ...can u please tell what changes has to be made.... void CSearchDlg::OnSearch() { UpdateData(TRUE); if (m_INDEX_FILE.GetLength() < 0 ) { MessageBox("Select the Index File before searching !","Asis Search Engine",MB_OK | MB_ICONINFORMATION); return; } if (m_WORD.GetLength() < 0 ) { MessageBox("Enter the word to be searched","Asis Search Engine",MB_OK | MB_ICONINFORMATION); return; } } Regards, Vinay Charan.
Vinay wrote:
I have 2 edit box in my dialog m_INDEX_FILE & m_WORD & a Search button. on the OnSearch()i want to check if the user has entered data or not if the user has not entered data then i want to disply a message box for that i have used below code. but the problem is below code has no effect ...can u please tell what changes has to be made....
Try the following Code.
void CSearchDlg::OnSearch()
{
UpdateData(TRUE);
if (m_INDEX_FILE.IsEmpty())
{
MessageBox("Select the Index File before searching !","Asis Search Engine",MB_OK | MB_ICONINFORMATION);
return;
}
if (m_WORD.IsEmpty())
{
MessageBox("Enter the word to be searched","Asis Search Engine",MB_OK | MB_ICONINFORMATION);
return;
}
//Do your stuff here
UpdateData(FALSE);
}Knock out 't' from can't, You can if you think you can :cool:
-
Hi, I have 2 edit box in my dialog m_INDEX_FILE & m_WORD & a Search button. on the OnSearch()i want to check if the user has entered data or not if the user has not entered data then i want to disply a message box for that i have used below code. but the problem is below code has no effect ...can u please tell what changes has to be made.... void CSearchDlg::OnSearch() { UpdateData(TRUE); if (m_INDEX_FILE.GetLength() < 0 ) { MessageBox("Select the Index File before searching !","Asis Search Engine",MB_OK | MB_ICONINFORMATION); return; } if (m_WORD.GetLength() < 0 ) { MessageBox("Enter the word to be searched","Asis Search Engine",MB_OK | MB_ICONINFORMATION); return; } } Regards, Vinay Charan.
-
Hi, I have 2 edit box in my dialog m_INDEX_FILE & m_WORD & a Search button. on the OnSearch()i want to check if the user has entered data or not if the user has not entered data then i want to disply a message box for that i have used below code. but the problem is below code has no effect ...can u please tell what changes has to be made.... void CSearchDlg::OnSearch() { UpdateData(TRUE); if (m_INDEX_FILE.GetLength() < 0 ) { MessageBox("Select the Index File before searching !","Asis Search Engine",MB_OK | MB_ICONINFORMATION); return; } if (m_WORD.GetLength() < 0 ) { MessageBox("Enter the word to be searched","Asis Search Engine",MB_OK | MB_ICONINFORMATION); return; } } Regards, Vinay Charan.
vinaycool wrote:
on the OnSearch()i want to check if the user has entered data or not if the user has not entered data then i want to disply a message box for that i have used below code. but the problem is below code has no effect ...can u please tell what changes has to be made..
what about handlling NM_CHNAGE MESSAGE, and setting flag accordingly:)
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers, Alok Gupta VC Forum Q&A :- I/ IV