UITestControl.SetProperty Method
Sets the value of a given property.
Namespace: Microsoft.VisualStudio.TestTools.UITesting
Assembly: Microsoft.VisualStudio.TestTools.UITesting (in Microsoft.VisualStudio.TestTools.UITesting.dll)
Syntax
'Declaration
Public Sub SetProperty ( _
propertyName As String, _
value As Object _
)
public void SetProperty(
string propertyName,
Object value
)
public:
void SetProperty(
String^ propertyName,
Object^ value
)
member SetProperty :
propertyName:string *
value:Object -> unit
public function SetProperty(
propertyName : String,
value : Object
)
Parameters
- propertyName
Type: System.String
The property name.
- value
Type: System.Object
The value to be set.
Remarks
To access the properties of a UITestControl, for example to get the count of items in a list box, or to set the text on a button, you must use GetProperty and SetProperty to get and set the specific properties of the UITestControl. The propertyName parameter specifies the property to access.
To change the text on a WinButton, use SetProperty together with the parameter DisplayText, followed by the new text for the button.
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.
See Also
Reference
Microsoft.VisualStudio.TestTools.UITesting Namespace
Other Resources
How to: Use UI Control Actions and Properties in Your Coded UI Tests