Hey so i am trying to make a VB app that saves all of the items in my listview1 (Set to details, if it matters) to the settings. So i go into settings and make one named "dll" and it is set to "System.Collections.Specialized.StringCollecti ons" and has no value. Then i have the following function to save the listview1.items to the setting...
Code:
Private Function call_save() As Integer
Dim myCol As New StringCollection()
For Each lsvrow As ListViewItem In ListView1.Items
myCol.Add(lsvrow.Text)
Next
My.Settings.dll = myCol
My.Settings.Save()
End Function
Then on my form_load i have this code that doesn't work...
Code:
ListView1.Items.AddRange(My.Settings.dll)
But i get the following error:
Code:
Error 1 Overload resolution failed because no accessible 'AddRange' can be called with these arguments:
'Public Sub AddRange(items As System.Windows.Forms.ListView.ListViewItemCollection)': Value of type 'System.Collections.Specialized.StringCollection' cannot be converted to 'System.Windows.Forms.ListView.ListViewItemCollection'.
'Public Sub AddRange(items() As System.Windows.Forms.ListViewItem)': Value of type 'System.Collections.Specialized.StringCollection' cannot be converted to '1-dimensional array of System.Windows.Forms.ListViewItem'. C:\Users\****\Desktop\Everything\VC++\Advanced Injector\System Watch - Breach - Encyption 2.0\Form1.vb 83 9 System Watch - Breach - Encyption 2.0
I have not idea how to take the array from the setting, and put it into my listview... if you have any ideas or codes please let me know...
Yeh im not the best in VB so i might ask you to explain :P
Option Explicit On
Imports System
Imports System.Collections
Imports System.Collections.Specialized
Yup have them all...
try making that a string
Originally Posted by guza44_44
try making that a string
do you mean make the
ListView1.Items.AddRange(My.Settings.dll)
to:
ListView1.Items.AddRange(My.Settings.dll.string)
because then i get:
Code:
Error 1 Overload resolution failed because no accessible 'AddRange' can be called with these arguments:
'Public Sub AddRange(items As System.Windows.Forms.ListView.ListViewItemCollection)': Value of type 'String' cannot be converted to 'System.Windows.Forms.ListView.ListViewItemCollection'.
'Public Sub AddRange(items() As System.Windows.Forms.ListViewItem)': Value of type 'String' cannot be converted to '1-dimensional array of System.Windows.Forms.ListViewItem'. C:\Users\****\Desktop\Everything\VC++\Advanced Injector\System Watch - Breach - Encyption 2.0\Form1.vb 84 9 System Watch - Breach - Encyption 2.0
no like
Code:
Dim thingy as string
thing = my.settings.dll
ListView1.Items.AddRange(thingy)
thingy = Hilarious
Originally Posted by guza44_44
no like
Code:
Dim thingy as string
thing = my.settings.dll
ListView1.Items.AddRange(thingy)
But its an array of strings... So there is more than one string or phrase inside the setting... and addrange is adding a range, for just one string you would do "ListView1.Items.Add('thingy')"
String wont help, Give me a few minutes, Im playing around to see what i can do
Originally Posted by NextGen1
String wont help, Give me a few minutes, Im playing around to see what i can do
Ok thanks alot
Not a problem , Just bare with me (i gave myself a ten minute deadline)
Yeh i have had this question ever since i started VB... thought i would post it here to try and find an answer.
I guess im not as big of a VB noob as i said i was..
I am adding a breakpoint to see If I can debug this
Alright i have to go in like 10 mins because i have to get all my stuff ready for snowboarding.. If i don't get it figured out tonight ill try tomorrow
The listbox "stores" object references as the items rather than strings. It
will then return the object when you click or change the listbox selected
item.