HtmlElementCollection.GetElementsByName(String) HtmlElementCollection.GetElementsByName(String) HtmlElementCollection.GetElementsByName(String) HtmlElementCollection.GetElementsByName(String) Method


対応する名前を指定して要素のコレクションを取得します。Gets a collection of elements by their name.

 System::Windows::Forms::HtmlElementCollection ^ GetElementsByName(System::String ^ name);
public System.Windows.Forms.HtmlElementCollection GetElementsByName (string name);
member this.GetElementsByName : string -> System.Windows.Forms.HtmlElementCollection
Public Function GetElementsByName (name As String) As HtmlElementCollection


String String String String

要素の名前または ID。The name or ID of the element.


HtmlElementCollection プロパティが name と一致する要素を保持する NameAn HtmlElementCollection containing the elements whose Name property match name.

次のコード例を検索、FORMオブジェクト、名前を使用して、プログラムでサーバーにそのデータを送信します。The following code example finds a FORM object using its name, and submits its data to the server programmatically. コード例では、する必要があります、アプリケーション ホストをWebBrowserという名前のコントロールwebBrowser1します。The code example requires that your application hosts a WebBrowser control named webBrowser1.

private void SubmitForm(String formName)
	HtmlElementCollection elems = null;
	HtmlElement elem = null;

	if (webBrowser1.Document != null)
		HtmlDocument doc = webBrowser1.Document;
              elems = doc.All.GetElementsByName(formName);
              if (elems != null && elems.Count > 0) 
                  elem = elems[0];
                  if (elem.TagName.Equals("FORM"))
Private Sub SubmitForm(ByVal FormName As String)
    Dim Elems As HtmlElementCollection
    Dim Elem As HtmlElement

    If (WebBrowser1.Document IsNot Nothing) Then
        With WebBrowser1.Document
            Elems = .All.GetElementsByName(FormName)
            If (Not Elems Is Nothing And Elems.Count > 0) Then
                Elem = Elems(0)
                If (Elem.TagName.Equals("FORM")) Then
                End If
            End If
        End With
    End If
End Sub


中に、Idのプロパティ、HtmlElement必要があります一意で複数の要素を使用して、同じNameプロパティ。While the Id property of an HtmlElement must be unique, multiple elements can use the same Name property.