Multi StrInsert

Discussion in 'Questions (Windows Mobile)' started by tcgoh, Jan 26, 2008.

  1. tcgoh

    tcgoh Active Member Licensed User

    Hi all,

    Does anyone know is it possible to have a multiple StrInsert in a single code?

    Example:

    a=strinsert(textbox1.Text,8,";") + strinsert(textbox1.text,32,";")

    Thanks
     
  2. klaus

    klaus Expert Licensed User

    Hello tcgoh
    Insread of
    a=strinsert(textbox1.Text,8,";") + strinsert(textbox1.text,32,";")
    this work in VB but not in Basic4PPC

    you must use the concatenation character.
    a=strinsert(textbox1.Text,8,";")&strinsert(textbox1.text,32,";")

    Best regards
    Klaus
    Switzerland
     
  3. tcgoh

    tcgoh Active Member Licensed User

    Hi Klaus

    Thanks for the reply. But your code does work also.

    Error: Variable: Textbox was not assigned any value.

    Thanks
     
  4. specci48

    specci48 Well-Known Member Licensed User

    I think you have used copy and paste ... but you haven't removed the space in the second line of the code klaus provided.
    There has to be no space between "textbox" and "1" ...


    specci48
     
  5. Erel

    Erel Administrator Staff Member Licensed User

    There is an extra space between textbox and 1.
    Try:
    Code:
    a=strinsert(textbox1.Text,8,";") & strinsert(textbox1.text,32,";")
    I'm not sure that this is what you want to achieve.
    If you want to add these two characters, you need:
    Code:
    a = StrInsert(StrInsert(TextBox1.Text,8,";"),33,";")
     
  6. klaus

    klaus Expert Licensed User

    Of cours the extra space must not be there, was a wrong typing, I was concentrated in replacing the '+' sign by '&' .
    Sorry for the mistake.
    Klaus
     
  7. tcgoh

    tcgoh Active Member Licensed User

    Hi Erel,

    Oh Ya, there is space there. Thanks.

    But Erel is right on the spot on what I wanted. ie, add 2 char on the same line.

    Thanks again to all, the second code works fine.
     
Loading...