本文整理汇总了VB.NET中System.Web.UI.Control.AddParsedSubObject方法的典型用法代码示例。如果您正苦于以下问题:VB.NET Control.AddParsedSubObject方法的具体用法?VB.NET Control.AddParsedSubObject怎么用?VB.NET Control.AddParsedSubObject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Web.UI.Control
的用法示例。
在下文中一共展示了Control.AddParsedSubObject方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的VB.NET代码示例。
示例1: MyControlBuilder
' Custom ControlBuilder class. Interprets nested tag name "myitem" as a textbox.
Public Class MyControlBuilder
Inherits ControlBuilder
Public Overrides Function GetChildControlType(tagName As String, _
attributes As IDictionary) As Type
If String.Compare(tagName, "myitem", True) = 0 Then
Return GetType(TextBox)
End If
Return Nothing
End Function
End Class
<ControlBuilderAttribute(GetType(MyControlBuilder))> Public Class MyControl
Inherits Control
' Stores all the controls specified as nested tags.
Private items As New ArrayList()
' This function is internally invoked by IParserAccessor.AddParsedSubObject(Object).
Protected Overrides Sub AddParsedSubObject(obj As Object)
If TypeOf obj Is TextBox Then
items.Add(obj)
End If
End Sub
' Override 'CreateChildControls'.
Protected Overrides Sub CreateChildControls()
Dim myEnumerator As System.Collections.IEnumerator = items.GetEnumerator()
While myEnumerator.MoveNext()
Me.Controls.Add(CType(myEnumerator.Current, TextBox))
End While
End Sub
End Class