String question

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

    #1

    String question

    Is there a way to superscript a single character in a string
    for example to show a number raised to a exponent ?

    Eg

    lblResult.Capti on = " 52 in4 "

    Where the 4 would be superscripted ?

    Thanks for the advice

    Tom M


  • Rick Rothstein

    #2
    Re: String question

    > Is there a way to superscript a single character in a string[color=blue]
    > for example to show a number raised to a exponent ?
    >
    > Eg
    >
    > lblResult.Capti on = " 52 in4 "
    >
    > Where the 4 would be superscripted ?[/color]

    No, not using a Label (or TextBox for that matter). You can do what you
    ask using a RichTextBox though.

    With RichTextBox1
    .Text = " 52 in4 "
    ' Select the character(s) to superscript
    .SelStart = 6
    .SelLength = 1
    ' Set the amount of offset in TWIPS
    .SelCharOffset = 75
    End With

    Rick - MVP

    Comment

    • Steve Gerrard

      #3
      Re: String question


      "Rick Rothstein" <rickNOSPAMnews @NOSPAMcomcast. net> wrote in message
      news:Pb2dnckNLr _3PezfRVn-qQ@comcast.com. ..[color=blue][color=green]
      >> Is there a way to superscript a single character in a string
      >> for example to show a number raised to a exponent ?
      >>
      >> Eg
      >>
      >> lblResult.Capti on = " 52 in4 "
      >>
      >> Where the 4 would be superscripted ?[/color]
      >[/color]

      I've heard of square inches and cubic inches. What, pray tell, are inches to the
      4th power?

      Just curious :)


      Comment

      • Rick Rothstein

        #4
        Re: String question

        > >> Is there a way to superscript a single character in a string[color=blue][color=green][color=darkred]
        > >> for example to show a number raised to a exponent ?
        > >>
        > >> Eg
        > >>
        > >> lblResult.Capti on = " 52 in4 "
        > >>
        > >> Where the 4 would be superscripted ?[/color]
        > >[/color]
        >
        > I've heard of square inches and cubic inches. What, pray tell, are[/color]
        inches to the[color=blue]
        > 4th power?[/color]

        The volume of a hyper-cube? Or maybe just a badly constructed example?

        Rick

        Comment

        • Tmenke

          #5
          Re: String question

          inches to the fourth power is common in the engineering field to model the
          stiffness of a rigid body (Called the modulus of inertia). It is, in a
          nutshell, used
          to predict how much rotation a structural element will undergo when
          subjected to
          bending forces.

          Thanks for the advice Rick. You had once helped me with another post
          sometime ago
          about passing an array to a function.

          Question : Is the rich text box a standard control available in VB5 ? I
          haven't used one
          before and don't recall seeing one. And it's not in the handy little
          toolbox. Could you tell
          me how to use it "

          ----- Original Message -----
          From: "Rick Rothstein" <rickNOSPAMnews @NOSPAMcomcast. net>
          Newsgroups: comp.lang.visua l.basic
          Sent: Thursday, April 28, 2005 11:21 PM
          Subject: Re: String question

          [color=blue][color=green][color=darkred]
          > > >> Is there a way to superscript a single character in a string
          > > >> for example to show a number raised to a exponent ?
          > > >>
          > > >> Eg
          > > >>
          > > >> lblResult.Capti on = " 52 in4 "
          > > >>
          > > >> Where the 4 would be superscripted ?
          > > >[/color]
          > >
          > > I've heard of square inches and cubic inches. What, pray tell, are[/color]
          > inches to the[color=green]
          > > 4th power?[/color]
          >
          > The volume of a hyper-cube? Or maybe just a badly constructed example?
          >
          > Rick
          >[/color]

          "Rick Rothstein" <rickNOSPAMnews @NOSPAMcomcast. net> wrote in message
          news:f_udnd8hXf vSNezfRVn-qA@comcast.com. ..[color=blue][color=green][color=darkred]
          > > >> Is there a way to superscript a single character in a string
          > > >> for example to show a number raised to a exponent ?
          > > >>
          > > >> Eg
          > > >>
          > > >> lblResult.Capti on = " 52 in4 "
          > > >>
          > > >> Where the 4 would be superscripted ?
          > > >[/color]
          > >
          > > I've heard of square inches and cubic inches. What, pray tell, are[/color]
          > inches to the[color=green]
          > > 4th power?[/color]
          >
          > The volume of a hyper-cube? Or maybe just a badly constructed example?
          >
          > Rick
          >[/color]


          Comment

          • Rick Rothstein

            #6
            Re: String question

            > Question : Is the rich text box a standard control available[color=blue]
            > in VB5 ? I haven't used one before and don't recall seeing
            > one. And it's not in the handy little toolbox. Could you tell
            > me how to use it "[/color]

            In VB's IDE, click on Project/Components on the menu bar. Scroll down
            the list and click on the CheckBox labeled "Microsoft Rich Textbox
            Control", then click OK. That will add the RichTextBox to your toolbox.
            As for how to use it... well, it is full-bodied control with lots of
            properties, methods and events. Your best bet is to highlight the
            control after it is placed on your form and press F1 to bring up the
            help file for it. Then, start reading. Also, when the help files are
            displayed, click on the Search tab, type in "richtextbo x" (without the
            quote marks) into the search field and click the "List Topics" button.
            At minimum, read the item labeled "Using the Rich TextBox Control".

            Rick - MVP

            Comment

            • Martin

              #7
              Re: String question

              As an engineer myself this problem bugs me too. The work around that I
              prefer for simplicity is to use a separate label with the single character
              in a reduced size for my super and sub scripts. When printing to a printer
              check that you have the scaling correct else the labels may drift away from
              each other.


              Regards

              Martin


              "Tmenke" <menke68@netsca pe.net> wrote in message
              news:3b8bc$4271 9412$1860127d$2 3056@KNOLOGY.NE T...[color=blue]
              > Is there a way to superscript a single character in a string
              > for example to show a number raised to a exponent ?
              >
              > Eg
              >
              > lblResult.Capti on = " 52 in4 "
              >
              > Where the 4 would be superscripted ?
              >
              > Thanks for the advice
              >
              > Tom M
              >
              >[/color]


              Comment

              • Raoul Watson

                #8
                Re: String question


                "Tmenke" <menke68@netsca pe.net> wrote in message
                news:3b8bc$4271 9412$1860127d$2 3056@KNOLOGY.NE T...[color=blue]
                > Is there a way to superscript a single character in a string
                > for example to show a number raised to a exponent ?
                >
                > Eg
                >
                > lblResult.Capti on = " 52 in4 "
                >
                > Where the 4 would be superscripted ?
                >
                > Thanks for the advice
                >
                > Tom M
                >[/color]

                Just be careful with simple beam deflection or cantilevered calculations
                (see post on weird things in VB 6). Has always been there and will always
                be.

                We don't want our buildings and bridges be flawed cause someone uses VB math
                :)


                Comment

                • Steve Gerrard

                  #9
                  Re: String question


                  "Tmenke" <menke68@netsca pe.net> wrote in message
                  news:d8a0d$4271 adce$1860127d$1 0916@KNOLOGY.NE T...[color=blue]
                  > inches to the fourth power is common in the engineering field to model the
                  > stiffness of a rigid body (Called the modulus of inertia). It is, in a
                  > nutshell, used
                  > to predict how much rotation a structural element will undergo when
                  > subjected to
                  > bending forces.
                  >[/color]

                  I might have guessed there would be some use for it in engineering. Thanks for
                  the explanation.


                  Comment

                  • Egghead

                    #10
                    Re: String question

                    One more thing, do not forget to include the rich text box ocx when you
                    deploy your app.
                    It takes us a while to find that out when our app works in some clients' PC
                    but not others.

                    Egghead

                    "Rick Rothstein" <rickNOSPAMnews @NOSPAMcomcast. net> wrote in message
                    news:Xfidnaxs14 0jKOzfRVn-tw@comcast.com. ..[color=blue][color=green]
                    > > Question : Is the rich text box a standard control available
                    > > in VB5 ? I haven't used one before and don't recall seeing
                    > > one. And it's not in the handy little toolbox. Could you tell
                    > > me how to use it "[/color]
                    >
                    > In VB's IDE, click on Project/Components on the menu bar. Scroll down
                    > the list and click on the CheckBox labeled "Microsoft Rich Textbox
                    > Control", then click OK. That will add the RichTextBox to your toolbox.
                    > As for how to use it... well, it is full-bodied control with lots of
                    > properties, methods and events. Your best bet is to highlight the
                    > control after it is placed on your form and press F1 to bring up the
                    > help file for it. Then, start reading. Also, when the help files are
                    > displayed, click on the Search tab, type in "richtextbo x" (without the
                    > quote marks) into the search field and click the "List Topics" button.
                    > At minimum, read the item labeled "Using the Rich TextBox Control".
                    >
                    > Rick - MVP
                    >[/color]


                    Comment

                    • mickey

                      #11
                      Re: String question

                      On Fri, 29 Apr 2005 11:06:15 GMT, "Raoul Watson"
                      <WatsonR@Intell igenCIA.com> you typed some letters in random order:
                      [color=blue]
                      >We don't want our buildings and bridges be flawed cause someone uses VB math[/color]

                      That makes a great signature :)

                      Groetjenz,

                      Mickey
                      --
                      #### gewoan skrieve su ast ut seist ####

                      Comment

                      Working...