Export (0) Print
Expand All

HtmlElement.InvokeMember Method (String, Object[])

Executes a function defined in the current HTML page by a scripting language.

Namespace:  System.Windows.Forms
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)

public Object InvokeMember(
	string methodName,
	params Object[] parameter


Type: System.String

The name of the property or method to invoke.

Type: System.Object[]

A list of parameters to pass.

Return Value

Type: System.Object
The element returned by the function, represented as an Object. If this Object is another HTML element, and you have a reference to the unmanaged MSHTML library added to your project, you can cast it to its appropriate unmanaged interface.

This method can be used to call methods from the Document Object Model (DOM) that do not have equivalents in managed code. All arguments supplied to InvokeMember will be converted to Win32 VARIANT data types before they are passed to the named scripting function.

The following code example gets a TABLE called dataTable and uses the unexposed moveRow method to move a row from the end of the table to the beginning.

		private void ShiftRows(String tableName)
			if (webBrowser1.Document != null)
				HtmlDocument doc = webBrowser1.Document;
				HtmlElementCollection elems = doc.All.GetElementsByName(tableName);
				if (elems != null && elems.Count > 0)
					HtmlElement elem = elems[0];

					// Prepare the arguments.
					Object[] args = new Object[2];
					args[0] = (Object)"-1";
					args[1] = (Object)"0";

					elem.InvokeMember("moveRow", args);

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

© 2014 Microsoft