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

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

1 Answer 98 Views
PageView
This is a migrated thread and some comments may be shown as answers.
Mergen
Top achievements
Rank 1
Mergen asked on 18 Oct 2012, 12:45 AM
Hi,

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)

checkcurrenttaskthread.Start()

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!               

1 Answer, 1 is accepted

Sort by
0
Ivan Todorov
Telerik team
answered on 19 Oct 2012, 03:28 PM
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.

Greetings,
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.
Tags
PageView
Asked by
Mergen
Top achievements
Rank 1
Answers by
Ivan Todorov
Telerik team
Share this question
or