2

I have a number of tables like so:

Date  | DataLabel1
------------------
0/0/0 | 15
0/0/1 | 12

The tables will be build dynamically and I want to combine them to make something like a spreadsheet or database table, with the index being the date. Then I would populate the data with a function like

Sub Add(date,datalabel,value)
   'Find date row / add
   'Find column
   'Set Value
end sub

I have played with datatables in the past but found them to be cumbersome. Is there a better way?

1
  • 2
    Not really clear what you are trying to achieve! You can create data tables the way you want them to be. What is the actual problem? Commented Aug 17, 2013 at 2:10

1 Answer 1

2

There are so many programming ways to answer this, I am going to suggest a couple for you try:

  • Generic List of Classes that have Date and DateLabel members
  • HashTables
  • Multi-Dimensional Arrays
  • List

For what your describing a DataTable would not cumbersome, it would be reasonable and its the easiest out of all the suggested Data Types, eg:

DataTable dt = new DataTable();
dt.Columns.Add("Date");
dt.Columns.Add("DateLabel1");

DataRow dr = dt.NewRow();
dr[0] = date;
dr[1] = value;
dt.Rows.Add(dr);

dr = dt.NewRow();
dr[0] = date1;
dr[1] = value1;
dt.Rows.Add(dr);
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.