Excel to visual basics RRS feed

  • Question

  • Hi,

    I need to make an assignment in visual basics (2013) that includes reading in the data from an excel file. In this excel file there are 2 columns with a undetermined number of rows (see below). The data in column A stands for the X-axis and the data in column B stands for the Y-axis. The assignment is to make a curve in visual basics that follows these points one by one.

    5 5
    15 12
    25 15
    35 89
    45 25
    55 45
    65 15
    75 99
    85 12
    95 111
    105 154
    115 45

    Tuesday, April 28, 2015 10:00 AM


  • Hello MaartenSc,

    You could use the OleDb api to read these data into a class represents the point(you could just name it as Point with two properties:X and Y) as:

    public class Point
            public int X { get; set; }
            public int Y { get; set; }

    For reading data from a excel file by ADO.NET, you could use your favorite search tool, you could find lots of articles and blogs.

    After using the OleDb to read data to memory(usually, data is stored in a DataSet), you then could use a loop statement to populate the a collection type with the Point type as List<Point>. Then you could make a curve in visual basics according to the collection object.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • Marked as answer by Fred Bao Thursday, May 7, 2015 2:39 AM
    Wednesday, April 29, 2015 7:16 AM