how can I get an array from another form

  • Thread starter Thread starter Tim Geiges
  • Start date Start date
T

Tim Geiges

I need to be able to read a listview of items from my main form into
another form

I am trying to make an image viewer(which works so far) but want to add
a way to right click and select "next image" and have it get the name
of the next item from the Main form, or maybe a slide-show

any help is appreciated.

Thanks
Tim Geiges
 
Is it bad form to create an invisible listview in my second window and
have it populate itself with the items I need

I am guessing it is but I know it could be used to solve my problem,
however I will wait to hear from this group since you guys have been a
great help

thanks again,
Tim


(I accidentally posted this message to my old thread)
 
Tim Geiges said:
I need to be able to read a listview of items from my main form into
another form

I am trying to make an image viewer(which works so far) but want to add
a way to right click and select "next image" and have it get the name
of the next item from the Main form, or maybe a slide-show

any help is appreciated.

Thanks
Tim Geiges

What exactly is your problem?
Given classB with listviewB and classA
do you want to read valueB from listviewB
do you want to do that in classA?
 
well classA I would call my main form so I want to read valueA then B,C
.... from listViewA on classA and use it in classB and be able to call
any item from classA whenever I want tp update the picture I am
showing in classB(the listViewA has a list of images on the drive)
 
Tim Geiges said:
well classA I would call my main form so I want to read valueA then B,C
... from listViewA on classA and use it in classB and be able to call
any item from classA whenever I want tp update the picture I am
showing in classB(the listViewA has a list of images on the drive)

It all depends in which column the value is you wish to retrieve.
Here is a code sample; give it a try:
(You would need to click on the left hand column.)

private void listView1_SelectedIndexChanged(object sender, EventArgs e)
{
ListView.SelectedListViewItemCollection contents =
this.listView1.SelectedItems;
if(contents.Count>0)
{
textBox1.Text = contents[0].SubItems[1].Text;
}
else
{
textBox1.Text ="Error!";
}
}
 
Back
Top