Imports System
Imports System.Data
Imports System.Configuration
Imports System.Collections
Imports System.Web
Imports System.Web.Security
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Web.UI.WebControls.WebParts
Imports System.Web.UI.HtmlControls
Imports APNSoft.WebControls
Imports System.Xml
Partial Public Class ComboBox_PopulateDynamically
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
'Set empty DataSource from XmlDocument
myComboBox.DataSource = New XmlDocument()
myComboBox.DataBind()
'Get elements collection
Dim _Elements As ComboBoxElementCollection = myComboBox.Elements
'Add elements
_Elements.AddItem("AltaVista")
_Elements.AddItem("Google")
_Elements.AddItem("Yahoo")
_Elements.AddSeparator()
_Elements.AddItem("AlltheWeb")
_Elements.AddItem("dmoz")
_Elements.AddItem("Excite")
_Elements.AddItem("GO")
_Elements.AddItem("HotBot")
_Elements.AddItem("MSN")
_Elements.AddItem("Overture")
End Sub
End Class
|