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#
  4. Retrieve text on MessageBoxButton-button [modified]

Retrieve text on MessageBoxButton-button [modified]

Scheduled Pinned Locked Moved C#
question
12 Posts 5 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.
  • J Offline
    J Offline
    jjansen
    wrote on last edited by
    #1

    I'm using a MessageBox to give the user a choice. The text is something like "Press 'Yes' if you want to continue or press 'No' if you want to quit". However, I know my users will have Windows OS installed in various languages, other than English. I want to keep the message text in English, but I do want to let the 'Yes' and 'No' parts correspond to the actual texts on the messagebox button. Is there a way to find out the text that is displayed on the Yes-button given the language of Windows? Is there a function that can give me this button text. Thanks. -- modified at 9:25 Thursday 28th September, 2006

    N A N G 4 Replies Last reply
    0
    • J jjansen

      I'm using a MessageBox to give the user a choice. The text is something like "Press 'Yes' if you want to continue or press 'No' if you want to quit". However, I know my users will have Windows OS installed in various languages, other than English. I want to keep the message text in English, but I do want to let the 'Yes' and 'No' parts correspond to the actual texts on the messagebox button. Is there a way to find out the text that is displayed on the Yes-button given the language of Windows? Is there a function that can give me this button text. Thanks. -- modified at 9:25 Thursday 28th September, 2006

      N Offline
      N Offline
      Not Active
      wrote on last edited by
      #2

      You should use DialogResult if( MessaseBox.Show() == DialogResult.Yes )


      only two letters away from being an asset

      J 1 Reply Last reply
      0
      • J jjansen

        I'm using a MessageBox to give the user a choice. The text is something like "Press 'Yes' if you want to continue or press 'No' if you want to quit". However, I know my users will have Windows OS installed in various languages, other than English. I want to keep the message text in English, but I do want to let the 'Yes' and 'No' parts correspond to the actual texts on the messagebox button. Is there a way to find out the text that is displayed on the Yes-button given the language of Windows? Is there a function that can give me this button text. Thanks. -- modified at 9:25 Thursday 28th September, 2006

        A Offline
        A Offline
        AB7771
        wrote on last edited by
        #3

        Wht actually do u want to do???

        Thanks & Regards, Pramod "Everyone is a genius at least once a year"

        1 Reply Last reply
        0
        • J jjansen

          I'm using a MessageBox to give the user a choice. The text is something like "Press 'Yes' if you want to continue or press 'No' if you want to quit". However, I know my users will have Windows OS installed in various languages, other than English. I want to keep the message text in English, but I do want to let the 'Yes' and 'No' parts correspond to the actual texts on the messagebox button. Is there a way to find out the text that is displayed on the Yes-button given the language of Windows? Is there a function that can give me this button text. Thanks. -- modified at 9:25 Thursday 28th September, 2006

          N Offline
          N Offline
          Nader Elshehabi
          wrote on last edited by
          #4

          Hello You can using API function calls, but why the effort?!! You can inherit your own custom MessageBox from that class, or make your own form to simulate the MessageBox you want to display.

          Regards:rose:

          J 1 Reply Last reply
          0
          • J jjansen

            I'm using a MessageBox to give the user a choice. The text is something like "Press 'Yes' if you want to continue or press 'No' if you want to quit". However, I know my users will have Windows OS installed in various languages, other than English. I want to keep the message text in English, but I do want to let the 'Yes' and 'No' parts correspond to the actual texts on the messagebox button. Is there a way to find out the text that is displayed on the Yes-button given the language of Windows? Is there a function that can give me this button text. Thanks. -- modified at 9:25 Thursday 28th September, 2006

            G Offline
            G Offline
            Guffa
            wrote on last edited by
            #5

            Perhaps that is possible, but why do you want to present a translation table to the user? You should use a custom dialog so that you can put a meaningful text on the buttons, instead of telling the user that "Yes" means "Continue" and "No" means "Quit".

            --- b { font-weight: normal; }

            J 1 Reply Last reply
            0
            • N Not Active

              You should use DialogResult if( MessaseBox.Show() == DialogResult.Yes )


              only two letters away from being an asset

              J Offline
              J Offline
              jjansen
              wrote on last edited by
              #6

              Mark Nischalke wrote:

              You should use DialogResult if( MessaseBox.Show() == DialogResult.Yes )

              I know and I am, but in this case I'm interested in what text is visible to the user so I can incorperate the same text in my message text.

              1 Reply Last reply
              0
              • N Nader Elshehabi

                Hello You can using API function calls, but why the effort?!! You can inherit your own custom MessageBox from that class, or make your own form to simulate the MessageBox you want to display.

                Regards:rose:

                J Offline
                J Offline
                jjansen
                wrote on last edited by
                #7

                Nader Elshehabi wrote:

                You can inherit your own custom MessageBox from that class, or make your own form to simulate the MessageBox you want to display

                Yes, but then I have to make one for every language version of Windows the user might be using.

                N 1 Reply Last reply
                0
                • G Guffa

                  Perhaps that is possible, but why do you want to present a translation table to the user? You should use a custom dialog so that you can put a meaningful text on the buttons, instead of telling the user that "Yes" means "Continue" and "No" means "Quit".

                  --- b { font-weight: normal; }

                  J Offline
                  J Offline
                  jjansen
                  wrote on last edited by
                  #8

                  Guffa wrote:

                  but why do you want to present a translation table to the user?

                  Perhaps my example wasn't really appropriate. Try this message: "The item aleady exists in the list. Do you want to overwrite it? If you press 'No' the item will be lost." Now, if the user has, say, a French version of Windows I would like to replace the string 'No' with 'Non', because that is the text the French OS will display on the MessageBoxButton.No . Or if he has a German version I want to replace it with 'Nein'.

                  Guffa wrote:

                  You should use a custom dialog so that you can put a meaningful text on the buttons

                  Perhaps that is the better solution. Still, if anyone knows a method to query Windows for its standard texts, I am very interested. Thanks for your responses, all of you.

                  G 1 Reply Last reply
                  0
                  • J jjansen

                    Guffa wrote:

                    but why do you want to present a translation table to the user?

                    Perhaps my example wasn't really appropriate. Try this message: "The item aleady exists in the list. Do you want to overwrite it? If you press 'No' the item will be lost." Now, if the user has, say, a French version of Windows I would like to replace the string 'No' with 'Non', because that is the text the French OS will display on the MessageBoxButton.No . Or if he has a German version I want to replace it with 'Nein'.

                    Guffa wrote:

                    You should use a custom dialog so that you can put a meaningful text on the buttons

                    Perhaps that is the better solution. Still, if anyone knows a method to query Windows for its standard texts, I am very interested. Thanks for your responses, all of you.

                    G Offline
                    G Offline
                    Guffa
                    wrote on last edited by
                    #9

                    jjansen wrote:

                    Perhaps my example wasn't really appropriate. Try this message: "The item aleady exists in the list. Do you want to overwrite it? If you press 'No' the item will be lost."

                    Why not use a sentence that does not reference the text of the button at all? You can also make it clearer which of the items that will actually be lost: "An item with that name already exists in the list. Do you want to replace it? If you choose not to, the new item will be lost."

                    --- b { font-weight: normal; }

                    J 1 Reply Last reply
                    0
                    • G Guffa

                      jjansen wrote:

                      Perhaps my example wasn't really appropriate. Try this message: "The item aleady exists in the list. Do you want to overwrite it? If you press 'No' the item will be lost."

                      Why not use a sentence that does not reference the text of the button at all? You can also make it clearer which of the items that will actually be lost: "An item with that name already exists in the list. Do you want to replace it? If you choose not to, the new item will be lost."

                      --- b { font-weight: normal; }

                      J Offline
                      J Offline
                      jjansen
                      wrote on last edited by
                      #10

                      You're right, that would work too. If the question gets too complicated (or potentially confusing) to answer with a simple Yes or No you should go for the custum dialog anyway. Thanks.

                      1 Reply Last reply
                      0
                      • J jjansen

                        Nader Elshehabi wrote:

                        You can inherit your own custom MessageBox from that class, or make your own form to simulate the MessageBox you want to display

                        Yes, but then I have to make one for every language version of Windows the user might be using.

                        N Offline
                        N Offline
                        Nader Elshehabi
                        wrote on last edited by
                        #11

                        No! All you have to do is to make a public text property that will take the text depending on the user's language, then you wupply it with the text according to the current culture. You can store your texts in a string table, or even an array for whatever it's worth!! Another approach is to make an API call to MessageBoxEx() function. I think it does exactly what you want.

                        Regards:rose:

                        J 1 Reply Last reply
                        0
                        • N Nader Elshehabi

                          No! All you have to do is to make a public text property that will take the text depending on the user's language, then you wupply it with the text according to the current culture. You can store your texts in a string table, or even an array for whatever it's worth!! Another approach is to make an API call to MessageBoxEx() function. I think it does exactly what you want.

                          Regards:rose:

                          J Offline
                          J Offline
                          jjansen
                          wrote on last edited by
                          #12

                          Nader Elshehabi wrote:

                          You can store your texts in a string table, or even an array for whatever it's worth!!

                          The point is that I do not know WHICH languages I will encounter. Therefore, I can never make a 'complete' list of button texts (if I had that many dictionaries anyway). In order to make it work for ANY language I will need to ask Windows for the button texts. Anyway, Guffa has pointed me into another direction. Thanks though.

                          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