I'm working on an older project with VS2011, VB.NET and Steema Chart 2.0.3309.32489
I want to use the custom Pointer Styles, and used an example from the forum in C# as draft.
But I get an error
System.InvalidOperationException was unhandled
Message=An error occurred creating the form. See Exception.InnerException for details. The error is: Object reference not set to an instance of an object.
Source=Project1
StackTrace:
at Project1.My.MyProject.MyForms.Create__Instance__[T](T Instance) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 190
at Project1.My.MyProject.MyForms.get_frmMain()
at Project1.My.MyApplication.OnCreateMainForm() in C:\Main\Source\Project1\My Project\Application.Designer.vb:line 35
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)
at Project1.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 81
InnerException: System.NullReferenceException
Message=Object reference not set to an instance of an object.
Source=TeeChart
StackTrace:
at Steema.TeeChart.Styles.Series.GetLanguageSpecificTitle()
at Steema.TeeChart.Styles.Series.Added()
at Steema.TeeChart.Styles.SeriesCollection.Add(Series s)
at Steema.TeeChart.Styles.Series..ctor(Chart c)
at Steema.TeeChart.Styles.BaseLine..ctor(Chart c)
at Steema.TeeChart.Styles.CustomPoint..ctor(Chart c)
at Steema.TeeChart.Styles.Points..ctor(Chart c)
at Project1.ImagePoint..ctor(Chart c, Image i, String desc) in C:\Main\Source\Project1\Classes\ImagePoint.vb:line 11
at WebInspector.frmMain..ctor() in C:\Main\Source\Project1\Forms\frmMain.vb:line 142
InnerException:
{"Object reference not set to an instance of an object."}
Code: Select all
Public Class frmMain
Dim a As ImagePoint
Public Sub New()
InitializeComponent()
a = New ImagePoint(TChart1.Chart, Project1.My.Resources.imageGif, "desc")
End Sub
...
End Class
Public Class ImagePoint
Inherits Steema.TeeChart.Styles.Points
Private m_Image As Image
Private g As Steema.TeeChart.Drawing.Graphics3D
Private m_Description As String
Public Sub New(ByVal c As Steema.TeeChart.Chart, ByVal i As Image, Optional ByVal desc As String = "desc")
MyBase.New(c)
' ------------ here it breaks with following statement:
g = c.Graphics3D
m_Image = i
m_Description = desc
End Sub
Public Property Image() As Image
Get
Return m_image
End Get
Set(ByVal value As Image)
m_image = value
End Set
End Property
Public Overrides ReadOnly Property Description() As String
Get
Return m_Description
End Get
End Property
Public Overrides Sub DrawValue(ByVal index As Integer)
Dim R As Rectangle
If m_Image Is Nothing Then
MyBase.DrawValue(index)
Else
Pointer.HorizSize = m_Image.Width
Pointer.VertSize = m_Image.Height
Dim left As Integer = CInt(CalcXPos(index) - (Pointer.HorizSize / 2))
Dim top As Integer = CInt(CalcYPos(index) - (Pointer.VertSize / 2))
R = Rectangle.FromLTRB(left, top, left + Pointer.HorizSize, top + Pointer.VertSize)
g.Draw(R, m_Image, True)
g.TextOut(CalcXPos(index), CalcYPos(index), index.ToString)
End If
End Sub
End Class
What is the Object I have to set to a value?
Thanks
Newbie