Retrieve data from excel file to make charts using the visual basicReading Excel files from C#How to create Excel (.XLS and .XLSX) file in C# without installing Ms Office?Stop Excel from automatically converting certain text values to datesWhat is correct content-type for excel files?Is it possible to force Excel recognize UTF-8 CSV files automatically?Efficient way to import Excel data into SQLite db in VB.NetVBA Excel chart in User form error - Compiler Error- Argument not optionalVisual Basics not closing excelVisual Basic Unable to Read from Excel fileExcel VBA to filter Pivot Table and Pivot Chart for previous day - Pivot Filter Field

Why do some professors with PhDs leave their professorships to teach high school?

How does the spell Remove Curse interact with a Sword of Vengeance?

How many children?

Why tighten down in a criss-cross pattern?

How large would a mega structure have to be to host 1 billion people indefinitely?

Non-flat partitions of a set

Why do textbooks often include the solutions to odd or even numbered problems but not both?

Why does the Saturn V have standalone inter-stage rings?

Do I have to explain the mechanical superiority of the player-character within the fiction of the game?

Array initialization optimization

Is there a way, while dragging, to "snap" to the nearest guide?

How long would it take to cross the Channel in 1890's?

How do I handle a table mixing up the DM and the players' roles too often?

What is the legal status of travelling with methadone in your carry-on?

Who are the remaining King/Queenslayers?

Is "Busen" just the area between the breasts?

Has there been any indication at all that further negotiation between the UK and EU is possible?

If plants "alternate generations" between sporophytes and gametophytes, why don't we say the same of humans?

Is it damaging to turn off a small fridge for two days every week?

Prime sieve in Python

Why don't countries like Japan just print more money?

Would it be a copyright violation if I made a character’s full name refer to a song?

Should developer taking test phones home or put in office?

What was the Shuttle Carrier Aircraft escape tunnel?



Retrieve data from excel file to make charts using the visual basic


Reading Excel files from C#How to create Excel (.XLS and .XLSX) file in C# without installing Ms Office?Stop Excel from automatically converting certain text values to datesWhat is correct content-type for excel files?Is it possible to force Excel recognize UTF-8 CSV files automatically?Efficient way to import Excel data into SQLite db in VB.NetVBA Excel chart in User form error - Compiler Error- Argument not optionalVisual Basics not closing excelVisual Basic Unable to Read from Excel fileExcel VBA to filter Pivot Table and Pivot Chart for previous day - Pivot Filter Field






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















I'm fairly new to Visual Basic. I'm using the Visual Studio 2013 and MS Excel 2010. I would like to program a code with VB that can retrieve information from the Excel .xlsx file and using that information to make charts.



Here's the edited version:



Imports System.Reflection
Imports Excel = Microsoft.Office.Interop.Excel
'Add reference Assemblies, Framework, System.Windows.Forms.DataVisualization
'Imports System.Windows.Forms.DataVisualization.Charting


Public Class Form1

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click

Dim excelApp As Excel.Application
Dim excelWB As Excel.Workbook
Dim excelWS As Excel.Worksheet
Dim FNameRng As Excel.Range
Dim AveRng As Excel.Range
Dim AveCLRng As Excel.Range
Dim AveUCLRng As Excel.Range
Dim FNameArry As New ArrayList()
Dim AveArry As New ArrayList()
Dim AveCLArry As New ArrayList()
Dim AveUCLArry As New ArrayList()

excelApp = CreateObject("Excel.Application")
excelApp.Visible = False
'Open the Workbook
excelWB = excelApp.Workbooks.Open("C:UsersJoesphDocumentsChartsControl Limit18x17 - 10 mil stop.xlsx")
excelWS = excelApp.Sheets("18x17 - 10 mil stop")

'Set the Range for File Name
FNameRng = excelWS.Range("A2", excelWS.Range("A2").End(Excel.XlDirection.xlDown))
'Set the Range for Average Data
AveRng = excelWS.Range("B2", excelWS.Range("B2").End(Excel.XlDirection.xlDown))
AveCLRng = excelWS.Range("H2", excelWS.Range("H2").End(Excel.XlDirection.xlDown))
AveUCLRng = excelWS.Range("I2", excelWS.Range("I2").End(Excel.XlDirection.xlDown))

'Store Range as Array
FNameArry.Add(FNameRng.Value)
AveArry.Add(AveRng.Value)
AveCLArry.Add(AveCLRng.Value)
AveUCLArry.Add(AveUCLRng.Value)

Me.CenterToScreen()
Me.WindowState = FormWindowState.Maximized

Chart1.Titles.Add("Title1")
Chart1.Titles(0).Text = "Average"
Chart1.Titles(0).Font = New Font("Garamond", 24, FontStyle.Bold)

Chart1.Series("Series1").XValueMember = "FNameArry"
Chart1.Series("Series1").YValueMembers = "AveArry"
Chart1.Series("Series1").YValueMembers = "AveCLArry"
Chart1.Series("Series1").YValueMembers = "AveUCLArry"


End Sub
End Class


So, I store the Excel range into an arraylist. I used the array as the Chart points. The program now can run without any error, but it display nothing other than the chart title. What did I do wrong here? Do I have to loop the array for the chart to display the X and Y axis? Any help would be appreciated. Thank you!










share|improve this question






























    0















    I'm fairly new to Visual Basic. I'm using the Visual Studio 2013 and MS Excel 2010. I would like to program a code with VB that can retrieve information from the Excel .xlsx file and using that information to make charts.



    Here's the edited version:



    Imports System.Reflection
    Imports Excel = Microsoft.Office.Interop.Excel
    'Add reference Assemblies, Framework, System.Windows.Forms.DataVisualization
    'Imports System.Windows.Forms.DataVisualization.Charting


    Public Class Form1

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click

    Dim excelApp As Excel.Application
    Dim excelWB As Excel.Workbook
    Dim excelWS As Excel.Worksheet
    Dim FNameRng As Excel.Range
    Dim AveRng As Excel.Range
    Dim AveCLRng As Excel.Range
    Dim AveUCLRng As Excel.Range
    Dim FNameArry As New ArrayList()
    Dim AveArry As New ArrayList()
    Dim AveCLArry As New ArrayList()
    Dim AveUCLArry As New ArrayList()

    excelApp = CreateObject("Excel.Application")
    excelApp.Visible = False
    'Open the Workbook
    excelWB = excelApp.Workbooks.Open("C:UsersJoesphDocumentsChartsControl Limit18x17 - 10 mil stop.xlsx")
    excelWS = excelApp.Sheets("18x17 - 10 mil stop")

    'Set the Range for File Name
    FNameRng = excelWS.Range("A2", excelWS.Range("A2").End(Excel.XlDirection.xlDown))
    'Set the Range for Average Data
    AveRng = excelWS.Range("B2", excelWS.Range("B2").End(Excel.XlDirection.xlDown))
    AveCLRng = excelWS.Range("H2", excelWS.Range("H2").End(Excel.XlDirection.xlDown))
    AveUCLRng = excelWS.Range("I2", excelWS.Range("I2").End(Excel.XlDirection.xlDown))

    'Store Range as Array
    FNameArry.Add(FNameRng.Value)
    AveArry.Add(AveRng.Value)
    AveCLArry.Add(AveCLRng.Value)
    AveUCLArry.Add(AveUCLRng.Value)

    Me.CenterToScreen()
    Me.WindowState = FormWindowState.Maximized

    Chart1.Titles.Add("Title1")
    Chart1.Titles(0).Text = "Average"
    Chart1.Titles(0).Font = New Font("Garamond", 24, FontStyle.Bold)

    Chart1.Series("Series1").XValueMember = "FNameArry"
    Chart1.Series("Series1").YValueMembers = "AveArry"
    Chart1.Series("Series1").YValueMembers = "AveCLArry"
    Chart1.Series("Series1").YValueMembers = "AveUCLArry"


    End Sub
    End Class


    So, I store the Excel range into an arraylist. I used the array as the Chart points. The program now can run without any error, but it display nothing other than the chart title. What did I do wrong here? Do I have to loop the array for the chart to display the X and Y axis? Any help would be appreciated. Thank you!










    share|improve this question


























      0












      0








      0








      I'm fairly new to Visual Basic. I'm using the Visual Studio 2013 and MS Excel 2010. I would like to program a code with VB that can retrieve information from the Excel .xlsx file and using that information to make charts.



      Here's the edited version:



      Imports System.Reflection
      Imports Excel = Microsoft.Office.Interop.Excel
      'Add reference Assemblies, Framework, System.Windows.Forms.DataVisualization
      'Imports System.Windows.Forms.DataVisualization.Charting


      Public Class Form1

      Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click

      Dim excelApp As Excel.Application
      Dim excelWB As Excel.Workbook
      Dim excelWS As Excel.Worksheet
      Dim FNameRng As Excel.Range
      Dim AveRng As Excel.Range
      Dim AveCLRng As Excel.Range
      Dim AveUCLRng As Excel.Range
      Dim FNameArry As New ArrayList()
      Dim AveArry As New ArrayList()
      Dim AveCLArry As New ArrayList()
      Dim AveUCLArry As New ArrayList()

      excelApp = CreateObject("Excel.Application")
      excelApp.Visible = False
      'Open the Workbook
      excelWB = excelApp.Workbooks.Open("C:UsersJoesphDocumentsChartsControl Limit18x17 - 10 mil stop.xlsx")
      excelWS = excelApp.Sheets("18x17 - 10 mil stop")

      'Set the Range for File Name
      FNameRng = excelWS.Range("A2", excelWS.Range("A2").End(Excel.XlDirection.xlDown))
      'Set the Range for Average Data
      AveRng = excelWS.Range("B2", excelWS.Range("B2").End(Excel.XlDirection.xlDown))
      AveCLRng = excelWS.Range("H2", excelWS.Range("H2").End(Excel.XlDirection.xlDown))
      AveUCLRng = excelWS.Range("I2", excelWS.Range("I2").End(Excel.XlDirection.xlDown))

      'Store Range as Array
      FNameArry.Add(FNameRng.Value)
      AveArry.Add(AveRng.Value)
      AveCLArry.Add(AveCLRng.Value)
      AveUCLArry.Add(AveUCLRng.Value)

      Me.CenterToScreen()
      Me.WindowState = FormWindowState.Maximized

      Chart1.Titles.Add("Title1")
      Chart1.Titles(0).Text = "Average"
      Chart1.Titles(0).Font = New Font("Garamond", 24, FontStyle.Bold)

      Chart1.Series("Series1").XValueMember = "FNameArry"
      Chart1.Series("Series1").YValueMembers = "AveArry"
      Chart1.Series("Series1").YValueMembers = "AveCLArry"
      Chart1.Series("Series1").YValueMembers = "AveUCLArry"


      End Sub
      End Class


      So, I store the Excel range into an arraylist. I used the array as the Chart points. The program now can run without any error, but it display nothing other than the chart title. What did I do wrong here? Do I have to loop the array for the chart to display the X and Y axis? Any help would be appreciated. Thank you!










      share|improve this question
















      I'm fairly new to Visual Basic. I'm using the Visual Studio 2013 and MS Excel 2010. I would like to program a code with VB that can retrieve information from the Excel .xlsx file and using that information to make charts.



      Here's the edited version:



      Imports System.Reflection
      Imports Excel = Microsoft.Office.Interop.Excel
      'Add reference Assemblies, Framework, System.Windows.Forms.DataVisualization
      'Imports System.Windows.Forms.DataVisualization.Charting


      Public Class Form1

      Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click

      Dim excelApp As Excel.Application
      Dim excelWB As Excel.Workbook
      Dim excelWS As Excel.Worksheet
      Dim FNameRng As Excel.Range
      Dim AveRng As Excel.Range
      Dim AveCLRng As Excel.Range
      Dim AveUCLRng As Excel.Range
      Dim FNameArry As New ArrayList()
      Dim AveArry As New ArrayList()
      Dim AveCLArry As New ArrayList()
      Dim AveUCLArry As New ArrayList()

      excelApp = CreateObject("Excel.Application")
      excelApp.Visible = False
      'Open the Workbook
      excelWB = excelApp.Workbooks.Open("C:UsersJoesphDocumentsChartsControl Limit18x17 - 10 mil stop.xlsx")
      excelWS = excelApp.Sheets("18x17 - 10 mil stop")

      'Set the Range for File Name
      FNameRng = excelWS.Range("A2", excelWS.Range("A2").End(Excel.XlDirection.xlDown))
      'Set the Range for Average Data
      AveRng = excelWS.Range("B2", excelWS.Range("B2").End(Excel.XlDirection.xlDown))
      AveCLRng = excelWS.Range("H2", excelWS.Range("H2").End(Excel.XlDirection.xlDown))
      AveUCLRng = excelWS.Range("I2", excelWS.Range("I2").End(Excel.XlDirection.xlDown))

      'Store Range as Array
      FNameArry.Add(FNameRng.Value)
      AveArry.Add(AveRng.Value)
      AveCLArry.Add(AveCLRng.Value)
      AveUCLArry.Add(AveUCLRng.Value)

      Me.CenterToScreen()
      Me.WindowState = FormWindowState.Maximized

      Chart1.Titles.Add("Title1")
      Chart1.Titles(0).Text = "Average"
      Chart1.Titles(0).Font = New Font("Garamond", 24, FontStyle.Bold)

      Chart1.Series("Series1").XValueMember = "FNameArry"
      Chart1.Series("Series1").YValueMembers = "AveArry"
      Chart1.Series("Series1").YValueMembers = "AveCLArry"
      Chart1.Series("Series1").YValueMembers = "AveUCLArry"


      End Sub
      End Class


      So, I store the Excel range into an arraylist. I used the array as the Chart points. The program now can run without any error, but it display nothing other than the chart title. What did I do wrong here? Do I have to loop the array for the chart to display the X and Y axis? Any help would be appreciated. Thank you!







      vb.net excel






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 8 '14 at 17:59







      user3233328

















      asked Mar 6 '14 at 17:16









      user3233328user3233328

      1272310




      1272310






















          1 Answer
          1






          active

          oldest

          votes


















          0














          Here it is. I am using the OLE db driver to get data out of xlsx instead of Interop. I am also using 3 series instead of a single one with multiple Y values.



          Imports System.Windows.Forms.DataVisualization.Charting
          Imports System.Data
          Imports System.Data.OleDb

          'The Excel file name
          Dim fileName As String = "YourExcelData.xlsx"

          'connection string for Xlsx files - Microsoft ACE OLEDB 12.0
          'Connect to Excel 2007 (and later) files with the Xlsx file extension.
          'That is the Office Open XML format with macros disabled.
          ' "HDR=Yes;" indicates that the first row contains columnnames, not data.
          '"HDR=No;" indicates the opposite.


          '"+fileNameString+" remove String from it as defind above
          Dim sConn As String = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source="+fileNameString+";Extended Properties=""Excel 12.0 Xml;HDR=YES"";"
          Dim myConnection As New OleDbConnection(sConn)
          myConnection.Open()



          ' The code to follow uses a SQL SELECT command to display the data from the worksheet.
          ' Create new OleDbCommand to return data from worksheet.
          ' change range
          Dim myCommand As New OleDbCommand("Select * From [data1$A2:I2500]", myConnection)

          ' create a database reader
          Dim myReader As OleDbDataReader = myCommand.ExecuteReader (CommandBehavior.CloseConnection)
          ' Populate the chart with data in the file
          ' can also use Chart.DataBindTable
          Chart1.Series(0).Points.DataBindXY(myReader, "FNameArry", myReader, "AveArry")
          Chart1.Series(1).Points.DataBindXY(myReader, "FNameArry", myReader, "AveCLArry")
          Chart1.Series(2).Points.DataBindXY(myReader, "FNameArry", myReader, "AveUCLArry")

          ' close the reader and the connection
          myReader.Close()
          myConnection.Close()





          share|improve this answer



























            Your Answer






            StackExchange.ifUsing("editor", function ()
            StackExchange.using("externalEditor", function ()
            StackExchange.using("snippets", function ()
            StackExchange.snippets.init();
            );
            );
            , "code-snippets");

            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "1"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f22231427%2fretrieve-data-from-excel-file-to-make-charts-using-the-visual-basic%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            Here it is. I am using the OLE db driver to get data out of xlsx instead of Interop. I am also using 3 series instead of a single one with multiple Y values.



            Imports System.Windows.Forms.DataVisualization.Charting
            Imports System.Data
            Imports System.Data.OleDb

            'The Excel file name
            Dim fileName As String = "YourExcelData.xlsx"

            'connection string for Xlsx files - Microsoft ACE OLEDB 12.0
            'Connect to Excel 2007 (and later) files with the Xlsx file extension.
            'That is the Office Open XML format with macros disabled.
            ' "HDR=Yes;" indicates that the first row contains columnnames, not data.
            '"HDR=No;" indicates the opposite.


            '"+fileNameString+" remove String from it as defind above
            Dim sConn As String = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source="+fileNameString+";Extended Properties=""Excel 12.0 Xml;HDR=YES"";"
            Dim myConnection As New OleDbConnection(sConn)
            myConnection.Open()



            ' The code to follow uses a SQL SELECT command to display the data from the worksheet.
            ' Create new OleDbCommand to return data from worksheet.
            ' change range
            Dim myCommand As New OleDbCommand("Select * From [data1$A2:I2500]", myConnection)

            ' create a database reader
            Dim myReader As OleDbDataReader = myCommand.ExecuteReader (CommandBehavior.CloseConnection)
            ' Populate the chart with data in the file
            ' can also use Chart.DataBindTable
            Chart1.Series(0).Points.DataBindXY(myReader, "FNameArry", myReader, "AveArry")
            Chart1.Series(1).Points.DataBindXY(myReader, "FNameArry", myReader, "AveCLArry")
            Chart1.Series(2).Points.DataBindXY(myReader, "FNameArry", myReader, "AveUCLArry")

            ' close the reader and the connection
            myReader.Close()
            myConnection.Close()





            share|improve this answer





























              0














              Here it is. I am using the OLE db driver to get data out of xlsx instead of Interop. I am also using 3 series instead of a single one with multiple Y values.



              Imports System.Windows.Forms.DataVisualization.Charting
              Imports System.Data
              Imports System.Data.OleDb

              'The Excel file name
              Dim fileName As String = "YourExcelData.xlsx"

              'connection string for Xlsx files - Microsoft ACE OLEDB 12.0
              'Connect to Excel 2007 (and later) files with the Xlsx file extension.
              'That is the Office Open XML format with macros disabled.
              ' "HDR=Yes;" indicates that the first row contains columnnames, not data.
              '"HDR=No;" indicates the opposite.


              '"+fileNameString+" remove String from it as defind above
              Dim sConn As String = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source="+fileNameString+";Extended Properties=""Excel 12.0 Xml;HDR=YES"";"
              Dim myConnection As New OleDbConnection(sConn)
              myConnection.Open()



              ' The code to follow uses a SQL SELECT command to display the data from the worksheet.
              ' Create new OleDbCommand to return data from worksheet.
              ' change range
              Dim myCommand As New OleDbCommand("Select * From [data1$A2:I2500]", myConnection)

              ' create a database reader
              Dim myReader As OleDbDataReader = myCommand.ExecuteReader (CommandBehavior.CloseConnection)
              ' Populate the chart with data in the file
              ' can also use Chart.DataBindTable
              Chart1.Series(0).Points.DataBindXY(myReader, "FNameArry", myReader, "AveArry")
              Chart1.Series(1).Points.DataBindXY(myReader, "FNameArry", myReader, "AveCLArry")
              Chart1.Series(2).Points.DataBindXY(myReader, "FNameArry", myReader, "AveUCLArry")

              ' close the reader and the connection
              myReader.Close()
              myConnection.Close()





              share|improve this answer



























                0












                0








                0







                Here it is. I am using the OLE db driver to get data out of xlsx instead of Interop. I am also using 3 series instead of a single one with multiple Y values.



                Imports System.Windows.Forms.DataVisualization.Charting
                Imports System.Data
                Imports System.Data.OleDb

                'The Excel file name
                Dim fileName As String = "YourExcelData.xlsx"

                'connection string for Xlsx files - Microsoft ACE OLEDB 12.0
                'Connect to Excel 2007 (and later) files with the Xlsx file extension.
                'That is the Office Open XML format with macros disabled.
                ' "HDR=Yes;" indicates that the first row contains columnnames, not data.
                '"HDR=No;" indicates the opposite.


                '"+fileNameString+" remove String from it as defind above
                Dim sConn As String = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source="+fileNameString+";Extended Properties=""Excel 12.0 Xml;HDR=YES"";"
                Dim myConnection As New OleDbConnection(sConn)
                myConnection.Open()



                ' The code to follow uses a SQL SELECT command to display the data from the worksheet.
                ' Create new OleDbCommand to return data from worksheet.
                ' change range
                Dim myCommand As New OleDbCommand("Select * From [data1$A2:I2500]", myConnection)

                ' create a database reader
                Dim myReader As OleDbDataReader = myCommand.ExecuteReader (CommandBehavior.CloseConnection)
                ' Populate the chart with data in the file
                ' can also use Chart.DataBindTable
                Chart1.Series(0).Points.DataBindXY(myReader, "FNameArry", myReader, "AveArry")
                Chart1.Series(1).Points.DataBindXY(myReader, "FNameArry", myReader, "AveCLArry")
                Chart1.Series(2).Points.DataBindXY(myReader, "FNameArry", myReader, "AveUCLArry")

                ' close the reader and the connection
                myReader.Close()
                myConnection.Close()





                share|improve this answer















                Here it is. I am using the OLE db driver to get data out of xlsx instead of Interop. I am also using 3 series instead of a single one with multiple Y values.



                Imports System.Windows.Forms.DataVisualization.Charting
                Imports System.Data
                Imports System.Data.OleDb

                'The Excel file name
                Dim fileName As String = "YourExcelData.xlsx"

                'connection string for Xlsx files - Microsoft ACE OLEDB 12.0
                'Connect to Excel 2007 (and later) files with the Xlsx file extension.
                'That is the Office Open XML format with macros disabled.
                ' "HDR=Yes;" indicates that the first row contains columnnames, not data.
                '"HDR=No;" indicates the opposite.


                '"+fileNameString+" remove String from it as defind above
                Dim sConn As String = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source="+fileNameString+";Extended Properties=""Excel 12.0 Xml;HDR=YES"";"
                Dim myConnection As New OleDbConnection(sConn)
                myConnection.Open()



                ' The code to follow uses a SQL SELECT command to display the data from the worksheet.
                ' Create new OleDbCommand to return data from worksheet.
                ' change range
                Dim myCommand As New OleDbCommand("Select * From [data1$A2:I2500]", myConnection)

                ' create a database reader
                Dim myReader As OleDbDataReader = myCommand.ExecuteReader (CommandBehavior.CloseConnection)
                ' Populate the chart with data in the file
                ' can also use Chart.DataBindTable
                Chart1.Series(0).Points.DataBindXY(myReader, "FNameArry", myReader, "AveArry")
                Chart1.Series(1).Points.DataBindXY(myReader, "FNameArry", myReader, "AveCLArry")
                Chart1.Series(2).Points.DataBindXY(myReader, "FNameArry", myReader, "AveUCLArry")

                ' close the reader and the connection
                myReader.Close()
                myConnection.Close()






                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Mar 25 at 8:18









                Community

                11




                11










                answered Sep 6 '14 at 19:56









                andrei.ciprianandrei.ciprian

                1,9311920




                1,9311920





























                    draft saved

                    draft discarded
















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f22231427%2fretrieve-data-from-excel-file-to-make-charts-using-the-visual-basic%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

                    Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

                    Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript