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

radgridview SaveLayout

2 Answers 70 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Tasos
Top achievements
Rank 1
Tasos asked on 20 Jul 2014, 05:25 PM
Hi
when i am trying to save the layout of a radGridView to a memory stream i get the following error:
Property accessor 'EnableFastScrolling' on object 'Telerik.WinControls.UI.RadGridView' threw the following exception:'Object reference not set to an instance of an object.'
i am using devstudio 2012, win8.1, .net framework 4.0

Can you help please?

2 Answers, 1 is accepted

Sort by
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 22 Jul 2014, 06:12 AM
Hello Tasos,

Thank you for writing.

Following the provided information, I tried to reproduce the mentioned exception in the specified version 2014.2 715, but without any success. Here is my sample code snippet:
Private ms As New MemoryStream()
 
Public Sub New()
    InitializeComponent()
    Dim r As New Random()
    Dim table As New DataTable()
    table.Columns.Add("ID", GetType(Integer))
    table.Columns.Add("Name", GetType(String))
    table.Columns.Add("Bool", GetType(Boolean))
    table.Columns.Add("DateColumn", GetType(DateTime))
    For i As Integer = 0 To 9
        table.Rows.Add(i, "Row " & i, If(r.[Next](10) > 5, True, False), DateTime.Now.AddHours(i))
    Next
    Me.RadGridView1.DataSource = table
    RadGridView1.AutoSizeColumnsMode = Telerik.WinControls.UI.GridViewAutoSizeColumnsMode.Fill
    RadGridView1.EnableFastScrolling = True
End Sub
 
Private Sub RadButton1_Click(sender As Object, e As EventArgs) Handles RadButton1.Click      
    RadGridView1.SaveLayout(ms)
End Sub
 
Private Sub RadButton2_Click(sender As Object, e As EventArgs) Handles RadButton2.Click
    RadGridView1.LoadLayout(ms)
End Sub

Could you please specify the exact steps how to reproduce the problem? It would be greatly appreciated if you provide a sample project in the support thread that you have opened on a similar topic so I can investigate the precise case. Thank you in advance.

Regards,
Desislava
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
0
Tasos
Top achievements
Rank 1
answered on 22 Jul 2014, 07:33 AM
Hi 
It was my mistake as i try to savelayout to Dispose event. 
So please consider this as closed

Thank you very much
Tags
GridView
Asked by
Tasos
Top achievements
Rank 1
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Tasos
Top achievements
Rank 1
Share this question
or