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. help

help

Scheduled Pinned Locked Moved C / C++ / MFC
databasealgorithmshelptutorialquestion
15 Posts 3 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.
  • P philiptabraham

    Can anybody tell me how to clear the combo box in the OnEditChange Function. what i want is : i am searching and loading the ComboBox with values from the database based on the string i give in the ComboBox. So as the string changes i need new values to be loaded in the ComboBox. What is happening now is if i change the string,the ComboBox is loaded with values of the new string and the old string.I dont need the previous values.i tried RESETCONTENT function within the OnEditChange Function.But it didnt work. thanks in advance

    D Offline
    D Offline
    David Crow
    wrote on last edited by
    #2

    philiptabraham wrote:

    Can anybody tell me how to clear the combo box in the OnEditChange Function.

    See here.

    philiptabraham wrote:

    i tried RESETCONTENT function within the OnEditChange Function.But it didnt work.

    Why not? What happened? Be specific.


    "Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman

    "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

    P 1 Reply Last reply
    0
    • D David Crow

      philiptabraham wrote:

      Can anybody tell me how to clear the combo box in the OnEditChange Function.

      See here.

      philiptabraham wrote:

      i tried RESETCONTENT function within the OnEditChange Function.But it didnt work.

      Why not? What happened? Be specific.


      "Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman

      "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

      P Offline
      P Offline
      philiptabraham
      wrote on last edited by
      #3

      when i give the function it is always getting reseted. ex:i need to retrieve all the values from the database starting with 'p'.So ill give 'p' in the comboBox and the Corresponding values loaded into the combobox.But latter if i want retrieve all the values from the database starting with 'po', then it is listing all the datas starting with 'p' and 'po'. What i have done is in the EditChangeFunction i am fetching the user entered value from the combobox say 'p' create the query and call the database function.The Result from the database are stord in an array and this array is loaded into the ComboBox Using AddString.

      D C 2 Replies Last reply
      0
      • P philiptabraham

        when i give the function it is always getting reseted. ex:i need to retrieve all the values from the database starting with 'p'.So ill give 'p' in the comboBox and the Corresponding values loaded into the combobox.But latter if i want retrieve all the values from the database starting with 'po', then it is listing all the datas starting with 'p' and 'po'. What i have done is in the EditChangeFunction i am fetching the user entered value from the combobox say 'p' create the query and call the database function.The Result from the database are stord in an array and this array is loaded into the ComboBox Using AddString.

        D Offline
        D Offline
        David Crow
        wrote on last edited by
        #4

        philiptabraham wrote:

        when i give the function it is always getting reseted.

        Last time I checked, that is exactly what the CB_RESETCONTENT message is supposed to do.


        "Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman

        "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

        P 1 Reply Last reply
        0
        • P philiptabraham

          when i give the function it is always getting reseted. ex:i need to retrieve all the values from the database starting with 'p'.So ill give 'p' in the comboBox and the Corresponding values loaded into the combobox.But latter if i want retrieve all the values from the database starting with 'po', then it is listing all the datas starting with 'p' and 'po'. What i have done is in the EditChangeFunction i am fetching the user entered value from the combobox say 'p' create the query and call the database function.The Result from the database are stord in an array and this array is loaded into the ComboBox Using AddString.

          C Offline
          C Offline
          chandu004
          wrote on last edited by
          #5

          have you used combovariable.ResetContent(); before calling your query?

          -------------------------------------------- Suggestion to the members: Please prefix your main thread subject with [SOLVED] if it is solved. thanks. chandu.

          P 2 Replies Last reply
          0
          • D David Crow

            philiptabraham wrote:

            when i give the function it is always getting reseted.

            Last time I checked, that is exactly what the CB_RESETCONTENT message is supposed to do.


            "Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman

            "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

            P Offline
            P Offline
            philiptabraham
            wrote on last edited by
            #6

            this is a sample code that i have done OnEditChange() { m_aa.AddString("xxx");//m_aa is the variable of my combobox of Type CComboBox m_aa.AddString("YYY"); m_aa.RESETCONTENT();//will not allow me to edit the comboBox ,it will get reset } whati nedd is ,whenever i make a change in the combobox only xxx and yyy should be displayed in the combobox list. what is happening now is whenever i make or edit the combobox the number of time the data displaying is doubled

            C D 2 Replies Last reply
            0
            • P philiptabraham

              this is a sample code that i have done OnEditChange() { m_aa.AddString("xxx");//m_aa is the variable of my combobox of Type CComboBox m_aa.AddString("YYY"); m_aa.RESETCONTENT();//will not allow me to edit the comboBox ,it will get reset } whati nedd is ,whenever i make a change in the combobox only xxx and yyy should be displayed in the combobox list. what is happening now is whenever i make or edit the combobox the number of time the data displaying is doubled

              C Offline
              C Offline
              chandu004
              wrote on last edited by
              #7

              here, you are adding the string and then resetting the content. got it?

              1 Reply Last reply
              0
              • C chandu004

                have you used combovariable.ResetContent(); before calling your query?

                -------------------------------------------- Suggestion to the members: Please prefix your main thread subject with [SOLVED] if it is solved. thanks. chandu.

                P Offline
                P Offline
                philiptabraham
                wrote on last edited by
                #8

                what is happening is if i give restContent it will reset it after each character i enter in the combobox. For example if i type p the value is reseted where as i want to search a string for 'po'.

                1 Reply Last reply
                0
                • P philiptabraham

                  this is a sample code that i have done OnEditChange() { m_aa.AddString("xxx");//m_aa is the variable of my combobox of Type CComboBox m_aa.AddString("YYY"); m_aa.RESETCONTENT();//will not allow me to edit the comboBox ,it will get reset } whati nedd is ,whenever i make a change in the combobox only xxx and yyy should be displayed in the combobox list. what is happening now is whenever i make or edit the combobox the number of time the data displaying is doubled

                  D Offline
                  D Offline
                  David Crow
                  wrote on last edited by
                  #9

                  I'd hazard a guess and say that you that you might need to remove old items from the combobox before adding new ones? ;)


                  "Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman

                  "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

                  P 1 Reply Last reply
                  0
                  • C chandu004

                    have you used combovariable.ResetContent(); before calling your query?

                    -------------------------------------------- Suggestion to the members: Please prefix your main thread subject with [SOLVED] if it is solved. thanks. chandu.

                    P Offline
                    P Offline
                    philiptabraham
                    wrote on last edited by
                    #10

                    i need to retrieve all the values from the database starting with 'p'.So ill give 'p' in the comboBox and the Corresponding values loaded into the combobox.But latter if i want retrieve all the values from the database starting with 'po', then it is listing all the datas starting with 'p' and 'po'. if i give RESTCONTENT after writing p, it will get reseted. I wont be able to search for strings with 2 or 3 letters

                    C 1 Reply Last reply
                    0
                    • D David Crow

                      I'd hazard a guess and say that you that you might need to remove old items from the combobox before adding new ones? ;)


                      "Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman

                      "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

                      P Offline
                      P Offline
                      philiptabraham
                      wrote on last edited by
                      #11

                      i tried that also but its not getting it removed completely. what i tried is: On the second time before adding new string ill get the count and within the loop i tried to delete the string.But every thing is not getting deleted

                      D 1 Reply Last reply
                      0
                      • P philiptabraham

                        i need to retrieve all the values from the database starting with 'p'.So ill give 'p' in the comboBox and the Corresponding values loaded into the combobox.But latter if i want retrieve all the values from the database starting with 'po', then it is listing all the datas starting with 'p' and 'po'. if i give RESTCONTENT after writing p, it will get reseted. I wont be able to search for strings with 2 or 3 letters

                        C Offline
                        C Offline
                        chandu004
                        wrote on last edited by
                        #12

                        now i got your concept. you mean, you are dealing the on edit change event of the combo box it self. if so, do one thing. 1.first, before calling the query, preserve the string available in the combobox, in a temporarystring, by using getdlgitemtext(). 2.then reset your content. 3.then call your query and upload them into the combo using addstring. 4.then using setdlgitemtext set the temporary string to the dialog. but here, iam not sure about the cursor position. you have to check it out. lets see if any body suggests a better technique.

                        P 1 Reply Last reply
                        0
                        • P philiptabraham

                          i tried that also but its not getting it removed completely. what i tried is: On the second time before adding new string ill get the count and within the loop i tried to delete the string.But every thing is not getting deleted

                          D Offline
                          D Offline
                          David Crow
                          wrote on last edited by
                          #13

                          philiptabraham wrote:

                          On the second time before adding new string ill get the count and within the loop i tried to delete the string.But every thing is not getting deleted

                          Probably because you are removing from the top-down rather than from the bottom-up. Why are you not removing them all at once rather than one at a time?


                          "Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman

                          "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

                          1 Reply Last reply
                          0
                          • C chandu004

                            now i got your concept. you mean, you are dealing the on edit change event of the combo box it self. if so, do one thing. 1.first, before calling the query, preserve the string available in the combobox, in a temporarystring, by using getdlgitemtext(). 2.then reset your content. 3.then call your query and upload them into the combo using addstring. 4.then using setdlgitemtext set the temporary string to the dialog. but here, iam not sure about the cursor position. you have to check it out. lets see if any body suggests a better technique.

                            P Offline
                            P Offline
                            philiptabraham
                            wrote on last edited by
                            #14

                            thank a lot...

                            C 1 Reply Last reply
                            0
                            • P philiptabraham

                              thank a lot...

                              C Offline
                              C Offline
                              chandu004
                              wrote on last edited by
                              #15

                              wait a minute!!! now what happened to your cursor position? and what about my suggestion?(see down):-D;)

                              -------------------------------------------- Suggestion to the members: Please prefix your main thread subject with [SOLVED] if it is solved. thanks. chandu.

                              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