Hi,
I've a problem that I can't solve. Here it is:
Using Visual Studio 2008 SP1, Windows 7 Ultimate.
I'm filling one SortedList with Objects (Buttons), I've created one Settings file called Settings1, and added "Name" - "AddedControls", for "Type" I choose "System.Collections.SortedList", the "Scope" is "User".
Here is the code for filling the SortedList:
Private Sub pnlWorkSpace_DragDrop1(ByVal sender As Object, ByVal e As DragEventArgs) Handles pnlWorkSpace.DragDrop
Dim dropX As Single = e.X
Dim dropY As Single = e.Y
Dim NewButton As New Button
NewButton = CType(Me.mCurrentObject, Button)
NewButton.Text = "Added"
Me.Controls.Add(NewButton)
pbWorkspace.SendToBack()
pnlWorkSpace.SendToBack()
Dim dropLocation = New Point(dropX - NewButton.Size.Width \ 2, dropY - NewButton.Size.Height \ 2)
Dim dropPoint As New Point()
dropPoint = Me.PointToClient(dropLocation)
NewButton.Location = dropPoint
mObjectCollection.Add(NewButton.TabIndex, NewButton)
AddHandler NewButton.MouseDown, AddressOf NewButton_MouseDown
End Sub
The code for adding the SortedList in the Settings1 file is:
Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click
Settings1.Default.AddedControls = mObjectCollection
Settings1.Default.Save()
End Sub
When I run the application, I fill the form with some buttons, then I pres the "Save" button and it appears that the "mObjectCollection" is transfered in "Settings1.Default.AddedControls", but when I stop the application and run it again the "Settings1.Default.AddedControls" has value "Nothing".
Can anyone explain why that happens and what am I doing wrong.
Today, I've tried step by step mode in line "Settings1.Default.Save()", and when the pointer passed trough,I've looked at my projects folder where the Settings1.settings file is situated, and the "Date modified" option did not changed. I'm confused :(
Thank You in advance,
Julian