Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Edit Box

Edit Box

Scheduled Pinned Locked Moved C / C++ / MFC
databasealgorithmshelp
8 Posts 6 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    VinayCool
    wrote on last edited by
    #1

    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.

    H G E L V 7 Replies Last reply
    0
    • V VinayCool

      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.

      H Offline
      H Offline
      Hamid Taebi
      wrote on last edited by
      #2

      what is m_INDEX_FILE ?CString and m_WORD_**


      **_

      whitesky


      1 Reply Last reply
      0
      • V VinayCool

        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.

        G Offline
        G Offline
        GDavy
        wrote on last edited by
        #3

        check equality too... zero length strings m_INDEX_FILE.GetLength() <= 0

        1 Reply Last reply
        0
        • V VinayCool

          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.

          H Offline
          H Offline
          Hamid Taebi
          wrote on last edited by
          #4

          void CAnswerDlg::OnBnClickedMybutton() { CString str; m_Edit1.GetWindowText(str); if(str.IsEmpty()) MessageBox("Empty"); else MessageBox("not"); }_**


          **_

          whitesky


          1 Reply Last reply
          0
          • V VinayCool

            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.

            E Offline
            E Offline
            eli15021979
            wrote on last edited by
            #5

            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

            1 Reply Last reply
            0
            • V VinayCool

              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.

              L Offline
              L Offline
              Laxman Auti
              wrote on last edited by
              #6

              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:

              1 Reply Last reply
              0
              • V VinayCool

                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.

                V Offline
                V Offline
                VinayCool
                wrote on last edited by
                #7

                Hello All, I got the solution I used below code,its working fine. void CSearchDlg::OnSearch() { UpdateData(TRUE); if (m_INDEX_FILE.GetLength() <= 0 ) Thank you very much ......:)

                1 Reply Last reply
                0
                • V VinayCool

                  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.

                  T Offline
                  T Offline
                  ThatsAlok
                  wrote on last edited by
                  #8

                  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

                  1 Reply Last reply
                  0
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  • Login

                  • Don't have an account? Register

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • World
                  • Users
                  • Groups