We help IT Professionals succeed at work.

Help needed with a methode

Peter Kiers
Peter Kiers asked
on
Hi,

I have this methode that I have put in the code-section.
The code lines that I have marked with an arrow read the
column Date and column Time from a listview and puts it to-
gether in a string called arg. But I get an error because the
computer reads this: "13-4-201115:45". And it sholud be:
"13-4-2011 15:45" (a space between date and time)
What do I have to change in the code below to make this
correct.

Greetings,

Peter Kiers



public DataTable CreateChartData(int rowCount)
        {
            DataTable table = new DataTable("Table1");
            table.Columns.Add("Argument", typeof(string));
            table.Columns.Add("Value", typeof(decimal));
            DataRow row = null;
            for (int i = 0; i < rowCount; i++)
            {
                row = table.NewRow();
                arg = GetNodeText(ParentForm1.lvGlucose.Nodes[i], ParentForm1.lvGlucose.Columns[1]) +  <=====
                GetNodeText(ParentForm1.lvGlucose.Nodes[i], ParentForm1.lvGlucose.Columns[2]);         <======
                row["Argument"] = arg;                                                           
                val = GetNodeText(ParentForm1.lvGlucose.Nodes[i], ParentForm1.lvGlucose.Columns[3]);
                row["Value"] = val;
                table.Rows.Add(row);
            }
            return table;
        }

Open in new window

Comment
Watch Question

Freelance programmer / Consultant
Commented:
                arg = GetNodeText(ParentForm1.lvGlucose.Nodes[i], ParentForm1.lvGlucose.Columns[1]) +  " " +
                GetNodeText(ParentForm1.lvGlucose.Nodes[i], ParentForm1.lvGlucose.Columns[2]);         

Open in new window

Peter KiersOperator

Author

Commented:
Perfect. Thanks.

Peter
AndyAinscowFreelance programmer / Consultant

Commented:
A little tip that might help in future.

>>And it sholud be:    "13-4-2011 15:45" (a space between date and time)

Just give obvious things a try first before asking the question - they might work and be a lot less effort.