[Webinar] Streamline your web hosting managementRegister Today

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1094
  • Last Modified:

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

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?
  • 3
  • 2
1 Solution
Jini Jose.Net Team LeadCommented:
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);
ocaccyAuthor Commented:
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]
ocaccyAuthor Commented:
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,
ocaccyAuthor Commented:
Thank you.
My system is running now.

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now