I want to make an alarm system via dataGridView. I have 2 columns named "Name, Time". Those in the Time Columns should decrease by 1 per second. What do I need to do to edit them all at once?
you can use a DataTable and include it into the datagridview. Otherwise you can iterate through the rows and update everytime the "Time" column value. For both you have to run a timer. Tipp at this point: Let it run in different Threads: So you have one for the UI(-Interaction), one for other working parts and one for the timer, which calls every second the Updatefunction of the time column.
I extracted the list by transferring the times less than 30 seconds to the listbox using the for loop. As a temporary solution it works fine for now.
DateTime d1;
for (int i = 0; i < dataGridView1.RowCount - 1; i++)
{
d1 = Convert.ToDateTime(dataGridView1.Rows[i].Cells[1].Value);
// MessageBox.Show(d1.ToString());
if (d1 < dateTimePicker1.Value) // If less than 30 seconds send to listbox
listBox1.Items.Add(d1);
}
ListCheck();
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.