本文整理匯總了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