A
A
Artem Enin2019-05-16 13:03:42
JSON
Artem Enin, 2019-05-16 13:03:42

How to serialize / deserialize data to / from Json from a ListBox that is filled with List?

The bottom line is this. Hours and minutes are taken from two textboxes, respectively. The whole thing is brought into the sheet and converted to the TimeSpan format. But here at a stage of serialization the error takes off. I know that the error is in the conversion method. Please tell me what is wrong with me.
First I put it on the sheet

private void button3_Click(object sender, EventArgs e)
        {
            listBox1.Items.Add(txtHours.Text+":"+txtMinutes.Text);
        }

then I serialize the input
foreach (string f in listBox1.Items)
            {
               returnCompany.TimeSchedule.Add(TimeSpan.Parse(f));
            }

.......................
5cdd3299ed6af124713870.png

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question