1. i dragged a UserChartControl1 to form1 and added a button 2. in the class UserChart Control i added methods to get references to objects Plot1 and Plot2 3. then in Form1.Button1_Click i construct x1,y1,y2,and
Dim Datasetx As New SimpleDataset("xxx", x1, y1) Dim Datasety As New SimpleDataset("yyy", x1, y2)
i can then update the chart on Form1 by calling
Dim plot2 As SimpleLinePlot plot2 = Me.UserChartControl11.Plot2 plot2.SetDataset(Datasetx) Me.UserChartControl11.UpdateDraw()
this works ok -- i can update the plot by pushing the button
4. unfortunately this technique does not work for plot1 ie
Dim plot1 As SimpleScatterPlot plot1 = Me.UserChartControl11.Plot1 plot1.SetDataset(Datasety) Me.userChartcontrol11.UpdateDraw()
i get error message
"object reference not set to instance of object"
5. so -- how do i access a valid reference to object plot1 from Form1 so i can call SetDataset?
Your basic technique looks ok. I am sure that it just your implementation that has an error.
Use the debugger to check the value of the value returned by your call to
plot1 = Me.UserChartControl11.Plot1
You will probably find that plot1 one is null.
Why would the value of Me.UserChartControl11.Plot1 be null ?
This would be an error in your Me.UserChartControl11.Plot1 class. My guess is that you either failed to assign the value of Plot1 correctly, or you have both local and global copies of the variable and assign the local one but not the global one. You are clearly accessing the global one in Me.UserChartControl11.Plot1. You may need to trace through that program and determine why the value is ending up as null.
Please post back if you find the problem on your own.
Turned out to be a bug in the DLL after all. Sorry to attribute it to a programming error. That is the last time I will be 99.9% certain about something.
Registered owners of the software can download updated version using their orignal download links.