"Object reference not set to an instance of an object" problem

2 posts, 0 answers
  1. Mergen
    Mergen avatar
    9 posts
    Member since:
    Feb 2012

    Posted 17 Oct 2012 Link to this post


    I'm trying to use pageview backstage mode in my multi-threading application, but I always get the following error:

    "Object reference not set to an instance of an object"

    Basically, I create a new thread and in that thread I am trying to make a specific item button and the related page selected. Below is the code:

    Dim CurrentTask As Integer = 1

    Dim backStageElement As RadPageViewBackstageElement

    Private Sub Form1_Load(sender As Object, e As System.EventArgs) Handles Me.Load

    Control.CheckForIllegalCrossThreadCalls = False

    Dim checkcurrenttaskthread As New Threading.Thread(AddressOf checkcurrenttask)


    End Sub

    Public Sub checkcurrenttask()

    While True

    If CurrentTask = 1 Then

    backStageElement =

    TryCast(RadPageView1.ViewElement, RadPageViewBackstageElement)

    backStageElement.Items(0).IsSelected = True

    RadPageView1.SelectedPage = RadPageView1.Pages(0)

    End If

    End While

    End Sub

    Is it because I call the pageview control in a thread-unsafe way? How can I get rid of that error?

    Thanks in advance!               
  2. Ivan Todorov
    Ivan Todorov avatar
    688 posts

    Posted 19 Oct 2012 Link to this post

    Hi Mergen,

    Please check my reply in the support ticket with the same topic you have opened. If you have any other questions, feel free to ask.

    Ivan Todorov
    the Telerik team
    You’ve been asking for it and now it’s time for us to deliver. RadControls for WinForms Q3 2012 release is just around the corner. Sign up for a free webinar to see first all the latest enhancements.
Back to Top