Alternative to using .SetSelection - Printable Version +- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums) +-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP) +--- Forum: VB Scripting/Descriptive Programming (https://www.learnqtp.com/forums/Forum-VB-Scripting-Descriptive-Programming) +--- Thread: Alternative to using .SetSelection (/Thread-Alternative-to-using-SetSelection) |
Alternative to using .SetSelection - janriis - 11-23-2009 Hi all When testing a VB6 application, I am using .SetSelection to select all text in a vbedit object and replacing with new value. For some reason, the .SetSelection often fails and my script stops due to wrong value in the vbedit object. Is there another way to select or even better, clear the values of a vbedit object ? RE: Alternative to using .SetSelection - upadhyay40 - 11-23-2009 Code: Dim EditToSearch hi jnariss, you need to just change your micclass as per you VBedit and try above code you an get your answer, please let me know if you need more help from my end Thanks Mahesh RE: Alternative to using .SetSelection - janriis - 11-23-2009 Hi Mahesh My app is not a web app, but a windows application written in VB6.0. What i need is a way to clear a vbedit field before entering new text. Example. in my vbedit field "txtAge" i have the default value 65. My new value is 40. If i just just .type "40", the default value wont be erased. Using setSelection 0,0,0,2 works sometimes, but is not reliable. RE: Alternative to using .SetSelection - jsknight1969 - 11-24-2009 Did you try: Code: Vbedit("txtAge").Set "1" <--- just to set focus to field You might also try using: Code: 'use tab to get to the txtAge field Hope this works. RE: Alternative to using .SetSelection - v_selvam - 11-24-2009 Try this. Code: text = VbWindow("Form1").VbEdit("Text1").getROProperty("text) RE: Alternative to using .SetSelection - Saket - 11-25-2009 an alternative of SetSelection could be using 'SendKeys' try this Code: 'Set Focus on edit box RE: Alternative to using .SetSelection - janriis - 12-08-2009 Thx for your input guys. For some reason, neither of above worked and my vbedit field was not cleared. RE: Alternative to using .SetSelection - Saket - 12-09-2009 Can you paste what you have tried so far? RE: Alternative to using .SetSelection - janriis - 12-09-2009 Hi Saket. I've tried all of the above and all I did was changing the code to correspond to my objects. Still none of the solution worked. What did work was using .setSelection 0,0 and then adding a handful of lines with .type micDel This is not the best way to do it, but due to lack of time, I have to go with this solution |