vb.netchartsmschart

Adding a title to chart, can´t find the title element


Can't find my title element to the chart even do I add title to the chart.

   Imports System.Web.UI.DataVisualization.Charting
With chartResult
Dim t As Title = .Titles.Add("title1")
.Titles("title1").Alignment = ContentAlignment.MiddleLeft 'This is saying it can´t
can´t find the title 
end With

Argumentexception unhandle by user code A chart element with the name 'title1' could not be found in the 'TitleCollection'.


Solution

  •     Dim t As Title = chartResult.Titles.Add("Title1")
        t.Alignment = ContentAlignment.MiddleLeft