Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
problems with formatting text
#1
Solved: 10 Years, 9 Months, 1 Week ago
i have a text box i want to put the time and date in so i can keep track of the times the tests are run
Code:
SwfWindow("Form").SwfEdit("TextboxName").Set "time " & Time()

the problem is i want to format the time a certain way so i wrote this function
Code:
Function formatmyTime
Dim myTime
FormatDateTime Now(), 3
myTime = "Time = " & Month(Now()) & "." & Day(Now()) & "." & Year(Now()) & " " & Time()
myTime = Replace(myTime,":",".")
End Function
myTime should now be 7.15.2008 9.25.57 AM
now how do i make it call myTime
Code:
SwfWindow("Form").SwfEdit("TextboxName").Set "time " & Time()
the reason is that it creates so many records in the database i wanted to add the seconds to them i can search the database easier. and the reason i have to format it is because my textbox does not allow the : character
Reply
#2
Solved: 10 Years, 9 Months, 1 Week ago
you need to do a small change in code:

Code:
Function formatmyTime
Dim myTime
FormatDateTime Now(), 3
myTime = "Time = " & Month(Now()) & "." & Day(Now()) & "." & Year(Now()) & " " & Time()
formatmyTime = Replace(myTime,":",".")
End Function

Code:
SwfWindow("Form").SwfEdit("TextboxName").Set "formatmyTime"
Want to fast track your QTP/UFT Learning? Join our UFT Training Course
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Problems with Text color recognition Treirk 0 980 06-17-2019, 12:19 PM
Last Post: Treirk
  Need to Validate Text filed is blank after clicking on the Text box balak89 3 4,543 09-13-2015, 12:06 AM
Last Post: ADITI1992
  I am trying to extract text from a webelement but it is generating blank text scenari excellentpawan 2 4,288 08-13-2013, 08:37 PM
Last Post: excellentpawan
  Problems with URL as Object identifier??? jcraig26 1 3,172 02-27-2013, 05:06 PM
Last Post: anil2u
  QTP recording problems Masa 2 2,333 11-11-2012, 08:28 AM
Last Post: Masa

Forum Jump:


Users browsing this thread: 1 Guest(s)