Bind an ArrayList to a DataGrid

W

Wayne Wengert

I want to bind an arraylist to a datagrid. If someone could point me to some
sample code (VB) I'd really appreciate it.

Wayne
 
K

Ken Cox [Microsoft MVP]

http://authors.aspalliance.com/aldotnet/examples/cd.aspx

Sub Page_Load(Sender As Object, e As EventArgs)
If Not IsPostBack Then
Dim values As New ArrayList()

values.Add(New PositionData("Microsoft", "Msft"))
values.Add(New PositionData("Intel", "Intc"))
values.Add(New PositionData("Dell", "Dell"))

myDataGrid.DataSource = values
myDataGrid.DataBind()

End If
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,824
Latest member
Nater888

Latest Threads

Top