Lisviews and data arrays in CF

  • Thread starter Thread starter Darren
  • Start date Start date
D

Darren

Can somebody please tell me what is wrong with the following:

Dim i As Integer
For i = 1 To dataArray.Length - 1
lsvCurrentFileList.Items.Add(New ListViewItem(dataArray(i)))
Next i

I am trying to send a list of files from a desktop PC to a Pocket PC. The
Pocket PC recieves it OK as I can display the array in a messagebox but
when I try it in a listview the application locks up.

Am I missing something here?

I can do it fine on the desktop PC in the same way.

Thanks
 
i dont know if this helps but i am reading data from a
file and populating a listview controll in C# though here
is what i got :
lbBatch.Items.Clear();
using (StreamReader sr =
File.OpenText(@"\My Documents\Optracs\Physical.txt"))
{
string line;
while ((line = sr.ReadLine
()) != null)
{
lbBatch.Items.Add
(line);
}
sr.Close();
}
 
Thanks for replying, but I don't understand what to do.

If I use,

lsvCurrentFileList.Items.Add(New ListViewItem(dataArray(1)))

it works fine, but I don't know how many entries will be added.

Thanks again.
 
Your code:
Dim i As Integer
For i = 1 To dataArray.Length - 1
lsvCurrentFileList.Items.Add(New ListViewItem(dataArray(i)))
Next i

What I was thinking was more like:

Dim i As Integer

For i = 0 To dataArray.Length - 1

Dim lvi As New ListViewItem(dataArray(i))

lsvCurrentFileList.Items.Add(lvi)

Next
 
Thanks for replying again but your suggestion didn't work, it still
locks up the application, even though it recives it OK.

Thanks
 
Hi,

Could you please send a simple application that reproduces the problem?

Thank you,
Sergiy.

This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
| Subject: Re: Lisviews and data arrays in CF
| From: Darren <[email protected]>
| References: <[email protected]>
<[email protected]>
<[email protected]>
<u#[email protected]>
| Organization: Your Company
| Message-ID: <[email protected]>
| User-Agent: Xnews/06.01.10
| Newsgroups: microsoft.public.dotnet.framework.compactframework
| Date: Wed, 06 Aug 2003 10:06:35 -0700
| NNTP-Posting-Host: public1-macc1-6-cust118.bagu.broadband.ntl.com
213.106.195.118
| Lines: 1
| Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msftngp13.phx.gbl
| Xref: cpmsftngxa06.phx.gbl
microsoft.public.dotnet.framework.compactframework:30299
| X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework
|
| Thanks for replying again but your suggestion didn't work, it still
| locks up the application, even though it recives it OK.
|
| Thanks
|
| |
| > Your code:
| > Dim i As Integer
| > For i = 1 To dataArray.Length - 1
| > lsvCurrentFileList.Items.Add(New ListViewItem(dataArray(i)))
| > Next i
| >
| > What I was thinking was more like:
| >
| > Dim i As Integer
| >
| > For i = 0 To dataArray.Length - 1
| >
| > Dim lvi As New ListViewItem(dataArray(i))
| >
| > lsvCurrentFileList.Items.Add(lvi)
| >
| > Next
| >
| >
| >
| > | >> Thanks for replying, but I don't understand what to do.
| >>
| >> If I use,
| >>
| >> lsvCurrentFileList.Items.Add(New ListViewItem(dataArray(1)))
| >>
| >> it works fine, but I don't know how many entries will be added.
| >>
| >> Thanks again.
| >>
| >>
| >> | >>
| >> > Try unwinding the statement in the loop, and explicitly declare
| >> > each piece. Late binding is a problem with the CF.
| >> >
| >> > | >> >>
| >> >> Can somebody please tell me what is wrong with the following:
| >> >>
| >> >> Dim i As Integer
| >> >> For i = 1 To dataArray.Length - 1
| >> >> lsvCurrentFileList.Items.Add(New ListViewItem(dataArray(i)))
| >> >> Next i
| >> >>
| >> >> I am trying to send a list of files from a desktop PC to a Pocket
| >> >> PC.
| >> >> The Pocket PC recieves it OK as I can display the array in a
| >> >> messagebox but when I try it in a listview the application locks
| >> >> up.
| >> >>
| >> >> Am I missing something here?
| >> >>
| >> >> I can do it fine on the desktop PC in the same way.
| >> >>
| >> >> Thanks
| >> >
| >> >
| >>
| >
| >
| >
|
|
 
Back
Top