Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Creating an object via Function Library
#1
Solved: 11 Years, 3 Months, 4 Weeks ago
Hi,

Is it possible to create a description of an object via a function from the function library? I'm trying to get this code to work properly, but I keep getting the error: "Wrong number of arguments or invalid property assignment." The description of the objTextbox is created when I call the function, but it returns back to the action as Empty. Can anyone help?

This is the code from the action, Flight_NewSale:
Code:
Public objTextbox

' Create the instances of the objects in the form
txtName = createTextbox("attached name", "Arrival Time:")

And then here's the code from the Function Library:
Code:
Public Function createTextbox(nameProperty, valProperty)
  On Error Resume Next

  ' Create a textbox object
  Set objTextbox = Description.Create()
  objTextbox("Class Name").Value = "WinEdit"
  objTextbox(nameProperty).Value = valProperty

  ' Return the object
  createTextbox = objTextbox ' object is created but is returned as Empty
  If Err <> 0 Then
     msgbox Err.Description
  End If
End Function
Reply


Messages In This Thread
Creating an object via Function Library - by riechan - 06-19-2012, 02:11 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Calling a function in a Test Script from a function library anupam4j 3 6,127 06-26-2015, 12:31 AM
Last Post: babu123
  Using QTP features in Function library TurtleRock 0 1,737 01-30-2014, 06:02 PM
Last Post: TurtleRock
  QTP is not recognizing Function Library Path associated to the test AshokReddy 2 4,105 12-19-2013, 01:59 PM
Last Post: AshokReddy
  Accessing Environment variable value in Library file vishruth143 1 2,572 09-07-2013, 05:11 AM
Last Post: jacosta
  Creating Random String SomeIntern 0 5,082 08-21-2013, 09:10 PM
Last Post: SomeIntern

Forum Jump:


Users browsing this thread: 1 Guest(s)