The code below saves the settings and functions I made during runtime:
Question:Can I actually save this into a database?
I mean.. logically speaking somehow like this:
Dim x as string
x = My.Settings.savedGroups.AddRange(Array.ConvertAll(groups.OrderBy(Function(g) g.Left).ToArray, Function(g) g.ToString))
Purpose: So that I can Load the settings and functions I made from the database.
Private Sub Form1_FormClosed(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosedEventArgs) Handles Me.FormClosed
My.Settings.savedGroups.Clear()
My.Settings.savedGroups.AddRange(Array.ConvertAll(groups.OrderBy(Function(g) g.Left).ToArray, Function(g) g.ToString))
My.Settings.savedCards.Clear()
My.Settings.savedCards.AddRange(Array.ConvertAll(panels.OrderBy(Function(p) p.Parent.Name).ThenBy(Function(p) p.Top).ToArray, Function(cp) cp.ToString))
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
If My.Settings.savedGroups Is Nothing Then
My.Settings.savedGroups = New Specialized.StringCollection
Else
Array.ConvertAll(My.Settings.savedGroups.Cast(Of String).ToArray, Function(s) loadGroup(s))
End If
If My.Settings.savedCards Is Nothing Then
My.Settings.savedCards = New Specialized.StringCollection
Else
Array.ConvertAll(My.Settings.savedCards.Cast(Of String).ToArray, Function(s) loadCard(s))
End If
cms.Items.Add("Delete group", Nothing, AddressOf deleteGroup)
End Sub
My.settings Designer:
<Global.System.Configuration.UserScopedSettingAttribute(), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute()> _
Public Property savedGroups() As Global.System.Collections.Specialized.StringCollection
Get
Return CType(Me("savedGroups"),Global.System.Collections.Specialized.StringCollection)
End Get
Set
Me("savedGroups") = value
End Set
End Property
<Global.System.Configuration.UserScopedSettingAttribute(), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute()> _
Public Property savedCards() As Global.System.Collections.Specialized.StringCollection
Get
Return CType(Me("savedCards"),Global.System.Collections.Specialized.StringCollection)
End Get
Set
Me("savedCards") = value
End Set
End Property
Question:Can I actually save this into a database?
I mean.. logically speaking somehow like this:
Dim x as string
x = My.Settings.savedGroups.AddRange(Array.ConvertAll(groups.OrderBy(Function(g) g.Left).ToArray, Function(g) g.ToString))
Purpose: So that I can Load the settings and functions I made from the database.
Private Sub Form1_FormClosed(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosedEventArgs) Handles Me.FormClosed
My.Settings.savedGroups.Clear()
My.Settings.savedGroups.AddRange(Array.ConvertAll(groups.OrderBy(Function(g) g.Left).ToArray, Function(g) g.ToString))
My.Settings.savedCards.Clear()
My.Settings.savedCards.AddRange(Array.ConvertAll(panels.OrderBy(Function(p) p.Parent.Name).ThenBy(Function(p) p.Top).ToArray, Function(cp) cp.ToString))
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
If My.Settings.savedGroups Is Nothing Then
My.Settings.savedGroups = New Specialized.StringCollection
Else
Array.ConvertAll(My.Settings.savedGroups.Cast(Of String).ToArray, Function(s) loadGroup(s))
End If
If My.Settings.savedCards Is Nothing Then
My.Settings.savedCards = New Specialized.StringCollection
Else
Array.ConvertAll(My.Settings.savedCards.Cast(Of String).ToArray, Function(s) loadCard(s))
End If
cms.Items.Add("Delete group", Nothing, AddressOf deleteGroup)
End Sub
My.settings Designer:
<Global.System.Configuration.UserScopedSettingAttribute(), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute()> _
Public Property savedGroups() As Global.System.Collections.Specialized.StringCollection
Get
Return CType(Me("savedGroups"),Global.System.Collections.Specialized.StringCollection)
End Get
Set
Me("savedGroups") = value
End Set
End Property
<Global.System.Configuration.UserScopedSettingAttribute(), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute()> _
Public Property savedCards() As Global.System.Collections.Specialized.StringCollection
Get
Return CType(Me("savedCards"),Global.System.Collections.Specialized.StringCollection)
End Get
Set
Me("savedCards") = value
End Set
End Property