Did you remember the namespaces?
Code:Option Explicit On Imports System Imports System.Collections Imports System.Collections.Specialized
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...
Then on my form_load i have this code that doesn't work...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
But i get the following error:Code:ListView1.Items.AddRange(My.Settings.dll)
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...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
Yeh im not the best in VB so i might ask you to explain :P
thanks Helicopter12
Did you remember the namespaces?
Code:Option Explicit On Imports System Imports System.Collections Imports System.Collections.Specialized
Yup have them all...
try making that a string
[IMG]https://i304.photobucke*****m/albums/nn168/guza44/sig-1.png[/IMG]
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)
[IMG]https://i304.photobucke*****m/albums/nn168/guza44/sig-1.png[/IMG]
thingy = Hilarious
String wont help, Give me a few minutes, Im playing around to see what i can do
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.
I'll see what I can do tonight