passing object reference

  • Thread starter Thread starter Thom
  • Start date Start date
T

Thom

Hello, I am creating an array of objects in one Sub and passing by value to
another Sub for processing where part of the data is displayed in a listview
box.

I would like to pass the same array of objects to a third sub for additional
processing based on user selection in listview box.

I must be missing something as I only get part of what I am trying to
accomplish. ie I get the selected index but the selected index is only a
portion of the original array object.

Any ideas? I would like to update the original array with data from user
selected listview items.

Thank you for your thoughts.

Thom
 
Hi Thom,

As far as I know is the selectedindex an integer which value tells which row
is selected in a non multiselect listview. What am I missing?

I can understand your message when I change selectedindex in selecteditem.

The selecteditem is the first part of the row, it has also subitems.

I do not know if this is your answer?

Cor
 
Cor said:
Hi Thom,

As far as I know is the selectedindex an integer which value tells which row
is selected in a non multiselect listview. What am I missing?

I can understand your message when I change selectedindex in selecteditem.

The selecteditem is the first part of the row, it has also subitems.

I do not know if this is your answer?

Cor

HI Cor -- thanks for getting back.
the trouble I have is referencing the entire original array that was created
as an object. I can get the pieces out of selected.index but also need the
original array. The selected.inex has about 9 items while the original array
has about 100.....I need the entire array to process and update.
Here is snippet of what i am doing.
This is creation:
For intFile = 1 To FileNameArray.Length

Dim myrecords As New loadfile

files = myrecords

myrecords.intFileNum = intFile - 1

'open the file and put filename into filenamearray()

FileOpen(intFile, FileNameArray(intFile - 1), OpenMode.Binary, .......blah
blah blah

After user manipulation I need to rewrite the original files with changes
from listviewbox

Dim SelectedFile As ListView.SelectedListViewItemCollection =
Me.ListViewBox.SelectedItems

'Dim file As ListViewItem

'For Each file In SelectedFile

Call SaveFiles(files)

So the trouble boils down to how do I reference the original object? I tried
to change Dim myrecords As New loadfile

to a Public myrecords As New loadfile but system gets mad at trying to
change the local variable.
 
Hi Thom,

You confuse me with listview.selectedindex that property I cannot find in
the listview.
I can find selectedindices (selectedindexcollection) but not selectedindex

Do you mean that you are itterating thru that?


Cor
 
Hi Thom,

Can you paste in that piece of code where you use those selectedindices,
maybe that gives me a clear view on it? (Please paste it in first in the
notebook, copy it back in a message, when it is pasted in direct it is
mostly impossible to get a good view on the problem)

Cor
 
Back
Top