Reproducing "&"

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Michel Vanderbeke

    Reproducing "&"

    Hello,

    Can you please help me?
    To produce a "&"-sign on the screen, I use "&&". Otherwise I get an
    underscore on the screen.
    However, when a text is in a database, and I use the same field to reproduce
    reports, the name in the report is written also with "&&".

    So I want to have it both ways: on screen as well as on paper a single "&"
    where a single "&" must be.
    How can I achieve this?

    Many thanks for your help,

    Michel


  • Andrew Morton

    #2
    Re: Reproducing "&&quo t;

    Michel Vanderbeke wrote:
    Can you please help me?
    To produce a "&"-sign on the screen, I use "&&". Otherwise I get an
    underscore on the screen.
    Do you mean when it appears in a menu? The ampersand is used in menus to
    indicate that the next character is the keyboard shortcut for that menu
    item.

    Could you use the word "and" instead?

    Andrew


    Comment

    • Cor Ligthert[MVP]

      #3
      Re: Reproducing "&&quo t;

      Michel,

      Probably you are from the BeNeLux and then from Flemish Belgium like your
      name is Vanderbeke and you use as a kind of anonymous name Flupke. Can you
      first tell us why the & gives an underscore on the screen. We would probably
      use the same settings but I have never noticed that.

      Cor

      "Michel Vanderbeke" <Flupke@newsgro up.nospamschree f in bericht
      news:uCkI1N98IH A.1468@TK2MSFTN GP05.phx.gbl...
      Hello,
      >
      Can you please help me?
      To produce a "&"-sign on the screen, I use "&&". Otherwise I get an
      underscore on the screen.
      However, when a text is in a database, and I use the same field to
      reproduce reports, the name in the report is written also with "&&".
      >
      So I want to have it both ways: on screen as well as on paper a single "&"
      where a single "&" must be.
      How can I achieve this?
      >
      Many thanks for your help,
      >
      Michel
      >

      Comment

      • Larry Smith

        #4
        Re: Reproducing &quot;&amp;&quo t;

        Can you please help me?
        To produce a "&"-sign on the screen, I use "&&". Otherwise I get an
        underscore on the screen.
        However, when a text is in a database, and I use the same field to
        reproduce reports, the name in the report is written also with "&&".
        >
        So I want to have it both ways: on screen as well as on paper a single "&"
        where a single "&" must be.
        How can I achieve this?
        You have to handle it manually. Access keys are automatically recognized by
        the system when you're dealing with windows (in menus, dialog controls,
        etc.) but for custom purposes you're on your own.


        Comment

        • Charlie Brown

          #5
          Re: Reproducing &quot;&amp;&quo t;

          On Aug 1, 10:39 am, "Larry Smith" <no_spam@_nospa m.comwrote:
          Can you please help me?
          To produce a "&"-sign on the screen, I use "&&".  Otherwise I get an
          underscore on the screen.
          However, when a text is in a database, and I use the same field to
          reproduce reports, the name in the report is written also with "&&".
          >
          So I want to have it both ways: on screen as well as on paper a single "&"
          where a single "&" must be.
          How can I achieve this?
          >
          You have to handle it manually. Access keys are automatically recognized by
          the system when you're dealing with windows (in menus, dialog controls,
          etc.) but for custom purposes you're on your own.
          Set the UseMnemonic property to False.

          Comment

          • Larry Smith

            #6
            Re: Reproducing &quot;&amp;&quo t;

            Set the UseMnemonic property to False.

            He didn't say he was using .NET but even if he is, that property only
            applies to buttons and labels (not menu items for instance). How would it
            help anyway.


            Comment

            • Charlie Brown

              #7
              Re: Reproducing &quot;&amp;&quo t;

              On Aug 1, 12:14 pm, "Larry Smith" <no_spam@_nospa m.comwrote:
              Set the UseMnemonic property to False.
              >
              He didn't say he was using .NET but even if he is, that property only
              applies to buttons and labels (not menu items for instance). How would it
              help anyway.
              Well, yes, you are correct, although I might mention that it was
              crossposted to the dotnet languages vb forum (from which I am
              reading). On a button, UseMnemonic disables the automatic "hot-key"
              that windows does and will present the & symbol without modification.
              I had not realized the menu items would not have the same property, I
              suppose I don't use them often enough.

              Comment

              • Patrice

                #8
                Re: Reproducing &quot;&amp;&quo t;

                "On the screen" is not enough ? We don't now if this is a Windows or Web
                application and how it is displayed. Is this in a control menu, a label, a
                textbox ? It all could cause distinct behaviors...

                --
                Patrice

                "Michel Vanderbeke" <Flupke@newsgro up.nospama écrit dans le message de
                groupe de discussion : uCkI1N98IHA.146 8@TK2MSFTNGP05. phx.gbl...
                Hello,
                >
                Can you please help me?
                To produce a "&"-sign on the screen, I use "&&". Otherwise I get an
                underscore on the screen.
                However, when a text is in a database, and I use the same field to
                reproduce reports, the name in the report is written also with "&&".
                >
                So I want to have it both ways: on screen as well as on paper a single "&"
                where a single "&" must be.
                How can I achieve this?
                >
                Many thanks for your help,
                >
                Michel
                >

                Comment

                • Larry Smith

                  #9
                  Re: Reproducing &quot;&amp;&quo t;

                  On Aug 1, 12:14 pm, "Larry Smith" <no_spam@_nospa m.comwrote:
                  Set the UseMnemonic property to False.
                  >
                  He didn't say he was using .NET but even if he is, that property only
                  applies to buttons and labels (not menu items for instance). How would it
                  help anyway.
                  Well, yes, you are correct, although I might mention that it was
                  crossposted to the dotnet languages vb forum (from which I am
                  reading).
                  I missed that.
                  On a button, UseMnemonic disables the automatic "hot-key"
                  that windows does and will present the & symbol without modification.
                  I had not realized the menu items would not have the same property, I
                  suppose I don't use them often enough.
                  It really depends on his needs. If he requires an access key in the same
                  string then he might wind up with this in his DB for example:

                  "Process && &Exit"

                  That beccomes "Process & Exit" when the user see it (with the ''E'
                  underlined). If he now dumps it to a report however then its his
                  responsibility to peform this magic himself. Of course he can always store
                  it as ""Process & Exit" instead and track the access key another way
                  (storing the offset of 'E' in a separate field for instance - when
                  displaying it on screen, he would then replace all single occurences of "&"
                  with "&&" and insert the access key "&" at the given offset - if he's
                  localizing it though then he'd have to store the offset for each language).


                  Comment

                  • =?ISO-8859-1?Q?G=F6ran_Andersson?=

                    #10
                    Re: Reproducing &quot;&amp;&quo t;

                    Michel Vanderbeke wrote:
                    Hello,
                    >
                    Can you please help me?
                    To produce a "&"-sign on the screen, I use "&&". Otherwise I get an
                    underscore on the screen.
                    However, when a text is in a database, and I use the same field to reproduce
                    reports, the name in the report is written also with "&&".
                    >
                    So I want to have it both ways: on screen as well as on paper a single "&"
                    where a single "&" must be.
                    How can I achieve this?
                    >
                    Many thanks for your help,
                    >
                    Michel
                    >
                    Strings often need different escaping depending on where it's used, for
                    example url encoding and html encoding.

                    In your case you need to escape the & character when you put the string
                    in a control by replacing it with &&.

                    You should store the text in the original form in the database, i.e.
                    with the single & characters, and do the replacement when you put the
                    text in the controls:

                    someControl.Tex t = textFromDatabas e.Replace("&", "&&")

                    --
                    Göran Andersson
                    _____
                    Göran Anderssons privata hemsida.

                    Comment

                    • Michel Vanderbeke

                      #11
                      Re: Reproducing &quot;&amp;&quo t;

                      Hello,

                      That is exactly what I was looking for!
                      Many thanks!

                      Michel



                      "Göran Andersson" <guffa@guffa.co mschreef in bericht
                      news:eQjpY2B9IH A.4820@TK2MSFTN GP06.phx.gbl...
                      Michel Vanderbeke wrote:
                      >Hello,
                      >>
                      >Can you please help me?
                      >To produce a "&"-sign on the screen, I use "&&". Otherwise I get an
                      >underscore on the screen.
                      >However, when a text is in a database, and I use the same field to
                      >reproduce reports, the name in the report is written also with "&&".
                      >>
                      >So I want to have it both ways: on screen as well as on paper a single
                      >"&" where a single "&" must be.
                      >How can I achieve this?
                      >>
                      >Many thanks for your help,
                      >>
                      >Michel
                      >
                      Strings often need different escaping depending on where it's used, for
                      example url encoding and html encoding.
                      >
                      In your case you need to escape the & character when you put the string in
                      a control by replacing it with &&.
                      >
                      You should store the text in the original form in the database, i.e. with
                      the single & characters, and do the replacement when you put the text in
                      the controls:
                      >
                      someControl.Tex t = textFromDatabas e.Replace("&", "&&")
                      >
                      --
                      Göran Andersson
                      _____
                      http://www.guffa.com

                      Comment

                      • David Connet

                        #12
                        Re: Reproducing &quot;&amp;&quo t;

                        Göran Andersson <guffa@guffa.co mwrote in
                        news:eQjpY2B9IH A.4820@TK2MSFTN GP06.phx.gbl:
                        Michel Vanderbeke wrote:
                        >Hello,
                        >>
                        >Can you please help me?
                        >To produce a "&"-sign on the screen, I use "&&". Otherwise I get an
                        >underscore on the screen.
                        >However, when a text is in a database, and I use the same field to
                        >reproduce reports, the name in the report is written also with "&&".
                        >>
                        >So I want to have it both ways: on screen as well as on paper a
                        >single "&" where a single "&" must be.
                        >How can I achieve this?
                        >>
                        >Many thanks for your help,
                        >>
                        >Michel
                        >>
                        >
                        Strings often need different escaping depending on where it's used,
                        for example url encoding and html encoding.
                        >
                        In your case you need to escape the & character when you put the
                        string in a control by replacing it with &&.
                        >
                        You should store the text in the original form in the database, i.e.
                        with the single & characters, and do the replacement when you put the
                        text in the controls:
                        >
                        someControl.Tex t = textFromDatabas e.Replace("&", "&&")
                        >
                        And depending on where this is being drawn, in Win32 there's the NOPREFIX
                        flag. THis applies to static text controls (SS_NOPREFIX) or DrawText
                        (DT_NOPREFIX).

                        Dave Connet


                        Comment

                        • Herfried K. Wagner [MVP]

                          #13
                          Re: Reproducing &quot;&amp;&quo t;

                          "David Connet" <stuff@agilityr ecordbook.comsc hrieb:
                          And depending on where this is being drawn, in Win32 there's the NOPREFIX
                          flag. THis applies to static text controls (SS_NOPREFIX) or DrawText
                          (DT_NOPREFIX).
                          This option is even available in .NET's 'TextRenderer.D rawText' if
                          'TextFormaFlags .NoPrefix' is specified.

                          --
                          M S Herfried K. Wagner
                          M V P <URL:http://dotnet.mvps.org/>
                          V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

                          Comment

                          Working...