Multiply text in a textbox.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Danny2008
    New Member
    • Jan 2008
    • 2

    Multiply text in a textbox.

    I was wondering if anyone knew how to multiply text in a textbox according to a specified amount in a textbox, if that doesn't make sense then...

    I type in Textbox1: aaa
    Then I type in The amount textbox: 10
    Then a third textbox would = aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa

    Hope it makes sense.

    Thanks.

    (I tried to google it but I could only find things to multiply numbers)
  • creative1
    Contributor
    • Sep 2007
    • 274

    #2
    It's pretty easy to do that:
    Suppose first text is in text1.Text and second in text2.Text then

    - store text2.Text in an Integer variable : suppose n
    - define a string (that will hold string after multiplying text1.Text) : suppose NewStr. Intially store NewStr = ""
    - use a loop (maybe for loop) e.g.
    [CODE=vb]For i = 0 To n-1
    NewStr = NewStr & text1.text
    Next i[/CODE]

    Finally you will have multiplied value stored in NewStr.
    I hope it will help you understand a little bit.

    P.S: theScripts Guys mention if I am wrong somewhere

    Kind regards
    Last edited by Killer42; Jan 1 '08, 11:55 AM.

    Comment

    • Danny2008
      New Member
      • Jan 2008
      • 2

      #3
      Thanks!

      This worked great and I have learnt something new.

      Comment

      • creative1
        Contributor
        • Sep 2007
        • 274

        #4
        thats good. Keep on doing good work.

        Comment

        • Killer42
          Recognized Expert Expert
          • Oct 2006
          • 8429

          #5
          Nice one, creative1.

          The only thing I think everyone is doing wrong here (and what caused the problems in trying to search for a solution) is using the term "multiply" when what you actually want is to "repeat" or make "copies" of a chunk of text. Searching on "multiply" is naturally going to return mostly mathematical type responses.

          Comment

          Working...