Page 1 of 1

Change shapestyle using VB.Net

Posted: Tue Apr 11, 2006 6:06 pm
by 9641066
Is there an VB.net equivalent for the following C# post? Using CType causes a runtime crash.

private void Button1_Click(object sender, System.EventArgs e)
{
(WebChart1.Chart.Series[0] as Steema.TeeChart.Styles.Shape).Style = Steema.TeeChart.Styles.ShapeStyles.Rectangle;
}

Posted: Wed Apr 12, 2006 8:19 am
by narcis
Hello,

It works fine for me here using:

Code: Select all

    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
        CType(WebChart1.Chart.Series(0), Steema.TeeChart.Styles.Shape).Style = Steema.TeeChart.Styles.ShapeStyles.Rectangle
    End Sub

Posted: Wed Apr 12, 2006 5:18 pm
by 9641066
Thanks for the quick reply. I tried that, but the error I'm getting at run time is:

Unable to to cast object of type 'Steema.TeeChart.Styles.Points' to type 'Steema.TeeChart.Styles.Shape'

I'm adding the points like this:

defectPoints(i) = New Steema.TeeChart.Styles.Points(tchart.Chart)

Posted: Thu Apr 13, 2006 8:13 am
by narcis
Hi newbie,

What you are doing here is adding point series. If you want to change its pointer style you need to do something like:

Code: Select all

CType(WebChart1.Chart.Series(1), Steema.TeeChart.Styles.Points).Pointer.Style = Steema.TeeChart.Styles.PointerStyles.Circle

Posted: Thu Apr 13, 2006 5:41 pm
by 9641066
Works great. Thanks!