What is up with - The Targeted Version of the .net Compact Frameworkdoes not support latebound overl

L

Loogie

I am trying to add contents of a table to a listview. I am using VB.Net
2005 compact framework. I can not add the subitems using code below. I
get an error for each subitem as follows:

The targeted version of the .net Compact Framework does not support
latebound overload resolution

Dim cmd As New System.Data.SqlServerCe.SqlCeCommand("Select p_item,
p_code, p_name from product", ssceconn)
Dim myReader As SqlCeDataReader = cmd.ExecuteReader()
Dim lvi As ListViewItem

While myReader.Read()
lvi = lsGlobals.Form4.lsvProds.Items.Add(myReader("p_item"))
lvi.SubItems.Add(myReader("p_code")) 'error thrown here
lvi.SubItems.Add(myReader("p_name")) 'error thrown here
End While

Any help as to how I can add the 3 fields to my listview?

Thanks

:L
 
G

Guest

My VB is rusty so the syntax may need slight adjustment, but something like
this:

While myReader.Read()
lvi = new ListViewItem( new string() {myReader("p_item"),
myReader("p_code"), myReader("p_name"))
lsGlobals.Form4.lsvProds.Items.Add(lvi)
End While


--

Chris Tacke, Embedded MVP
OpenNETCF Consulting
Managed Code in an Embedded World
www.OpenNETCF.com
 
J

James Caan

Try instead of myReader("x"):

myReader("x").ToString
or
Convert.ToString(myReader("x"))
 

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