Hi guys,
I want to change the width of a line chart

When I run with this code:

    Private Sub Chart1_Click(sender As Object, e As EventArgs) Handles Chart1.Click

        chart1.Series["Series1"].BorderWidth = 3;




        Chart1.DataBind()
        Chart1.Update()


    End Sub

I got this error. : Property access must assign to the property or use its value

Thanks for help.

Hi, Thanks for your suggestion.
But even I get rid of the semicolon after 3, I still got the same error

Here the code:

Private Sub Chart1_Click(sender As Object, e As EventArgs) Handles Chart1.Click

        Chart1.Series["Series1"].BorderWidth = 3


        Chart1.DataBind()
        Chart1.Update()


    End Sub

Edited 1 Year Ago by naz1234: grammar

Hi cgeir,
my data type, I get from my MS.Access database here, my data type is mostly as 'Double'

I tried to declare Chart1 as Double but the error shown, my Series is not member of double.

Here the full code:

Public Class Form1



    Private Sub Table1BindingNavigatorSaveItem_Click(sender As Object, e As EventArgs)
        Me.Validate()
        Me.Table1BindingSource.EndEdit()
        Me.TableAdapterManager.UpdateAll(Me.AcacacapDataSet)

    End Sub

    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        'TODO: This line of code loads data into the 'AcacacapDataSet.Table1' table. You can move, or remove it, as needed.
        Me.Table1TableAdapter.Fill(Me.AcacacapDataSet.Table1)

    End Sub

    Private Sub Table1BindingNavigator_RefreshItems(sender As Object, e As EventArgs)

    End Sub

    Private Sub TabPage1_Click(sender As Object, e As EventArgs) Handles TabPage1.Click

    End Sub

    Private Sub Chart1_Click(sender As Object, e As EventArgs) Handles Chart1.Click
        Dim Chart1 As Double

        Chart1.Series["Series1"].BorderWidth = 3


        Chart1.DataBind()
        Chart1.Update()


    End Sub


    Private Sub Table1DataGridView_CellContentClick(sender As Object, e As DataGridViewCellEventArgs)

    End Sub
    Private Sub Table1DataGridView_CellEndEdit(sender As Object, e As System.Windows.Forms.DataGridViewCellEventArgs)
        Try
            Dim iCell1 As Integer
            Dim icell3 As Integer
            Dim icellResult As Integer

            iCell1 = Table1DataGridView.CurrentRow.Cells(1).Value
            icell3 = Table1DataGridView.CurrentRow.Cells(3).Value
            icellResult = iCell1 * icell3
            Table1DataGridView.CurrentRow.Cells(2).Value = icellResult

        Catch ex As Exception
            MessageBox.Show(ex.ToString)
        End Try

    End Sub
End Class

I have two Series in my Chart.

It's hard to understand what exactly you want to do. However, to put a fframe around the chart you use:
Chart1.BorderSkin.SkinStyle = BorderSkinStyle.FrameThin1
and you can play around with different frames.

O.K. another way is to use the properties of the chart. Set BorderlineColor to black, BorderlineDashStyle to solid and than you can change the line thickness of the border

Edited 1 Year Ago by Minimalist

The answer to my question is:

Dim chart1 As New System.Windows.Forms.DataVisualization.Charting.Chart

In order to use it one needs to first be using .NET >= 4. Then a reference needs to be added to System.Windows.Forms.DataVisualization

Add Reference to System.Windows.Forms.DataVisualization:

-Project
-Add Reference
-.NET (tab)
-System.Windows.Forms.DataVisualization

Then add the following "Imports" statement: Imports System.Windows.Forms.DataVisualization

Your issue seems to be on line #29 (line #3 in the original post):
Chart1.Series["Series1"].BorderWidth = 3 should be Chart1.Series("Series1").BorderWidth = 3. VB .NET uses parentheses, not square brackets.

Edited 1 Year Ago by cgeier

This question has already been answered. Start a new discussion instead.