C#, How to put the array data in DataGridView?

Posted on 2011-10-28
Last Modified: 2012-08-13
I am getting values ¿¿from the serial port, and putting in variables.
How to put these data into arrays?
How to Put the array value in datagridview automatically once the array receiving the data?
Question by:ocaccy
    LVL 10

    Expert Comment

    by:Jini Jose
    is the getting values from the serial port is seperated by anything ?
    just like a,b,c etc.

    if so you can do like below

    string b="a,b,c";
    char split=Convert.ToChar(",");
    string[] a = b.Split(split);

    Author Comment

    We get a string like this:
    01,00000,00000,00000, laser error, error cell
    separated by commas.
    But I have 6 devices.
    In my project i try this:
    int myIndex[240]
    time myTime [240]
    string myID01[240]
    string myID02[240
    string myID03[240]
    string myID04[240

    And how to deposit these values ¿¿in variables?
    And how to show the values ¿¿of arrays in datagridview?

    e como
    string myID05[240]
    string myID06[240]
    LVL 10

    Accepted Solution


    Author Comment

    Hi, gmailjini.

    The contents of the link, in part answers my question.

    The application you're developing, has eight arrays.

    double MyIndex[240]
    date myDate[240]
    string myID01[240,6]
    string myID02[240,6]
    string myID03[240,6]
    string myID04[240,6]
    string myID05[240,6]
    string myID06[240,6]

    In the first part, we will collect data from the serial port and put in these 8 arrays.
    Once it receives data, I need showing their values automatically on a dataGridView for each of these arrays.
    dataGridView_Index, dataGridView_Date, dataGridView_ID01, dataGridView_ID02, dataGridView_ID03, dataGridView_ID04, dataGridView_ID05, dataGridView_ID06.

    After finishing the first part, we will have a button that performs all parts of the second part until the fifth part.

    In the second part, we will do equations with these 8 arrays, and put the results in double myGen1[240,18], and show double myGen1[240,18] in dataGridView_myGen1.
    In the third part, we will take the maximum and minimum of double myGen1[240,18], the results put in myGen2[240,18], and show double myGen2[240,18] in dataGridView_myGen2.
    In the fourth part, we will equations of selections of double myGen2[240,18], the results put in myGen3[240,18], and show double myGen3[240,18] in dataGridView_myGen3.
    In the fifth part, we will make equations of selections of double myGen3[240,18], the results put in double myLast[8,18], and show double myLast[8,18] in dataGridView_myLast.

    Best Regards,

    Author Closing Comment

    Thank you.
    My system is running now.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
    Today, still in the boom of Apple, PC's and products, nearly 50% of the computer users use Windows as graphical operating systems. If you are among those users who love windows, but are grappling to keep the system's hard drive optimized, then you s…
    This video shows how use content aware, what it’s used for, and when to use it over other tools.
    This video demonstrates how to use each tool, their shortcuts, where and when to use them, and how to use the keyboard to improve workflow.

    746 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now