This is a migrated thread and some comments may be shown as answers.

Save/Load Settings to/from Applications My.Settings

1 Answer 75 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Justin
Top achievements
Rank 1
Justin asked on 24 Aug 2012, 04:56 AM
Hi,

Is it possible to save and load a grids layout settings to/from an applications user settings (My.Settings) ?

Thanks in advance for any help.

Justin

1 Answer, 1 is accepted

Sort by
0
Jack
Telerik team
answered on 28 Aug 2012, 03:06 PM
Hello Justin,

Yes, this is possible by using a few lines of code. Please consider the following sample:
' save the grid layout to the GridLayout setting
Using stream As New MemoryStream()
    Me.radGridView1.SaveLayout(stream)
    stream.Position = 0
    Dim buffer As Byte() = New Byte(CInt(stream.Length) - 1) {}
    stream.Read(buffer, 0, buffer.Length)
    My.Settings.[Default].GridLayout = Convert.ToBase64String(buffer)
End Using
 
' load the layout
Using stream As New MemoryStream(Convert.FromBase64String(My.Settings.[Default].GridLayout))
    Me.radGridView1.LoadLayout(stream)
End Using

I hope it helps.
 
All the best,
Jack
the Telerik team
RadControls for WinForms Q2'12 release is now live! Check out what's new or download a free trial >>
Tags
GridView
Asked by
Justin
Top achievements
Rank 1
Answers by
Jack
Telerik team
Share this question
or