HtmlElementCollection.Count Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets the number of elements in the collection.
public:
property int Count { int get(); };
public int Count { get; }
member this.Count : int
Public ReadOnly Property Count As Integer
Property Value
An Int32 representing the number of elements in the collection.
Implements
Examples
The following code example finds a FORM
object using its name, and submits its data to the server programmatically. 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"))
{
elem.InvokeMember("Submit");
}
}
}
}
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
Elem.InvokeMember("Submit")
End If
End If
End With
End If
End Sub
Applies to
GitHub에서 Microsoft와 공동 작업
이 콘텐츠의 원본은 GitHub에서 찾을 수 있으며, 여기서 문제와 끌어오기 요청을 만들고 검토할 수도 있습니다. 자세한 내용은 참여자 가이드를 참조하세요.
.NET