Click here to Skip to main content
15,881,173 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
hey guys.this is my load method :
C#
FileStream fsRead = File.Open(openFileDialog1.FileName, FileMode.Open, FileAccess.ReadWrite);
BinaryFormatter binfmt = new BinaryFormatter();
ArrayList deserialized_array_list = (ArrayList)binfmt.Deserialize(fsRead);
Array listviewitem_array = (deserialized_array_list).ToArray(typeof(ListViewItem));
listView1.Items.AddRange((ListViewItem[])listviewitem_array);
fsRead.Close();

this method work for loading items, but how can set imageIndex to load items with image in imageList?
Posted
Updated 14-Oct-14 23:05pm
v2
Comments
Sergey Alexandrovich Kryukov 15-Oct-14 4:33am    
ListView? Which one? Full type name, please.
—SA
Member 10267630 15-Oct-14 4:36am    
listView1
Sergey Alexandrovich Kryukov 15-Oct-14 11:37am    
All right. I see. I asked the full type name, you answered "listView1".

I have only one advice: stop doing what you are doing and start learning programming from scratch. At this moment, you don't have a clue. Don't do UI or anything advanced. Learn what are types and instances, variables and members, methods and method parameters, to start with.

—SA
BillWoodruff 15-Oct-14 4:48am    
Is this WinForms ? WPF ? or ???

Please show an example of the data in the items in the deserialized ArrayList.
Sergey Alexandrovich Kryukov 15-Oct-14 11:37am    
Bill, please look at the OP's answer above ("listView1"). This person has no idea.
—SA

ImageList[^]: you control image index by the order of the loading images. I don't think you can set the index explicitely.
 
Share this answer
 
v2
C#
FileStream fsRead = File.Open(openFileDialog1.FileName, FileMode.Open, FileAccess.ReadWrite);
BinaryFormatter binfmt = new BinaryFormatter();
addresses = (ArrayList)binfmt.Deserialize(fsRead);


   foreach (DictionaryEntry de in addresses) 
        {
            //eject adress
           // Console.WriteLine("{0} lives at {1}.", de.Key, de.Value);
          // contrl index
          listView1.Items.AddRange(de.Value);
        }
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900