Listview and data bindings

D

Dvae c

I would like to create a listview control and data bind to a table (VB
code). I cannot seem to get the code correct to load the listview
control (new to .net CF programming). With the items and subitems, I
am a little confused on how to do this. Can someone provide code
examples? Thanks in advanced.
 
A

Arnaldo Fuziy

Listview doesn't support complex binding (e.g.
datagrid.datasource=datatable). Therefore, you should populate the listview
through items and subitems collection...

Suppose the orders table:
listview.beginupdate() 'avoids the flicker effect
for each row in datatable.rows
with row
lvwItem=new listviewitem("")
'--->>> the first column in your listview
lvwitem.text=.item("order_id")
'--->>> the other columns in your listview

'--->>> if you don't ctype your data column, it gives the error
message stating that CF
' doesn't support late bind
lvwitem.subitems.add(ctype(.item("cust_name"),string))
...
end with
listview.items.add(lvwitem)
next
listview.endupdate()

Hope it helps,

Arnaldo.
 

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

Top