Forum Discussion

tyrus's avatar
tyrus
Contributor
10 years ago

insert text at the begginign of a line

Hi, I need to insert some characters to the beginning of an previosuly entered line of text in a text control. How is this done? I noticed there is an "AppendText" function but it adds charcters to the end of an existing string? I can't use a standard keyword test since that is essentially rewriting the whole line, My test requires inserting a couble charcters in front of some already entered text.

 

thanks in advanced

2 Replies

  • djadhav's avatar
    djadhav
    Regular Contributor

    You can do it this way:

     

    Let's assume you text control is txt_UserName and you have already entered some text in it.

      Call txt_UserName.Click()
      Call txt_UserName.Keys("[Home]")
    'Below you can enter the text you want. e.g def as I have shown Call txt_UserName.Keys("def")

     

     

     

  • m_essaid's avatar
    m_essaid
    Valued Contributor

    Hi,

     

    I would do this this way :

     

    myvar:= yourcontrol.Text;

    yourcontrol.DblClick();

    yourcontrol.Keys('addedtext' + myvar);

     

    but there is plenty of other ways