Error at Styles.Series.GetLanguageSpecificTitle()

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
newbie
Newbie
Newbie
Posts: 11
Joined: Tue Apr 11, 2006 12:00 am
Contact:

Error at Styles.Series.GetLanguageSpecificTitle()

Post by newbie » Tue Oct 04, 2011 10:00 pm

Hello,
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

My question:
What is the Object I have to set to a value?

Thanks
Newbie

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: Error at Styles.Series.GetLanguageSpecificTitle()

Post by Sandra » Wed Oct 05, 2011 9:18 am

Hello newbie,

Can you please try to arrange a simple project so we can reproduce your problem exactly here?

Thanks,
Best Regards,
Sandra Pazos / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

newbie
Newbie
Newbie
Posts: 11
Joined: Tue Apr 11, 2006 12:00 am
Contact:

Re: Error at Styles.Series.GetLanguageSpecificTitle()

Post by newbie » Wed Oct 05, 2011 8:48 pm

Hello Sandra,
thanks for following up.
Actually it should work with a single TChart in a Windows Form.

I have reduced the code as much as I could:

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

  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 
  End Sub
Newbie

newbie
Newbie
Newbie
Posts: 11
Joined: Tue Apr 11, 2006 12:00 am
Contact:

Work around

Post by newbie » Wed Oct 05, 2011 8:53 pm

Hello,

I found another way to have a user defined Series and want to share this:

Code: Select all

Public Class frmMain
 Dim a As ImagePoint

  Public Sub New()
    InitializeComponent()   
    a = New ImagePoint(TChart1.Chart, Project1.My.Resources.imageGif, "desc")
    TChart1.Series.Add(a) 'connect to the TChart here
  End Sub
...

End Class

Public Class ImagePoint
  Inherits Steema.TeeChart.Styles.Points

  Public Sub New(ByVal c As Steema.TeeChart.Chart, ByVal i As Image, Optional ByVal desc As String = "desc")
    MyBase.New() ' old  MyBase.New(c)  ' do not make a reference in the constructor as it causes an error
  End Sub
Newbie

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: Error at Styles.Series.GetLanguageSpecificTitle()

Post by Sandra » Thu Oct 06, 2011 8:59 am

Hello newbie,

I couldn't still reproduce your problem here, using last version 2 of TeeChart.Net and next attach example:
ExampleVBVersion2.zip
(68.21 KiB) Downloaded 328 times
Please, can you tell us if my project works correctly? If it doesn't works correctly, could you modify the project so we can reproduce your error here?

Thanks,
Best Regards,
Sandra Pazos / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

newbie
Newbie
Newbie
Posts: 11
Joined: Tue Apr 11, 2006 12:00 am
Contact:

Re: Error at Styles.Series.GetLanguageSpecificTitle()

Post by newbie » Thu Oct 06, 2011 7:37 pm

Hello Sandra,
thanks for your effort, building an example.
The example works. So obviously there is something in my project, which causes the trouble.
There is a ApplicationEvent, which Handles Me.Startup
which is called before the New sub of the Form and there is a SplashScreen as well.

I give up finding the cause, as I have found a workaround. I did not find a Styles.Series.GetLanguageSpecificTitle() method, so I can not look for a not set reference/value.

Newbie

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: Error at Styles.Series.GetLanguageSpecificTitle()

Post by Sandra » Fri Oct 07, 2011 8:05 am

Hello newbie,

Ok. Thanks for your information, but the project I sent you is made with code your code and it works fine for me :). I am glad you can find a solution for it and if you have any problems please let me know

Thanks,
Best Regards,
Sandra Pazos / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Post Reply