I'm attempting to add a countdown to a data grid view which goes from 2 minutes to 0. When the button is pressed it should add a new row with a token and a 2 minute countdown. When the 2 minute countdown reaches 0 that row should be deleted. I have the token already set up and at the moment instead of a countdown I'm using time in 2 minutes. The main thing I want to achieve is deleting the token after 2 minutes which is when the token expires.
Here's my current code:
//Add Token To Grid
int row = 0;
TokenGrid.Rows.Add();
row = TokenGrid.Rows.Count - 2;
TokenGrid["CaptchaToken", row].Value = CaptchaWeb.Document.GetElementById("gcaptcha").GetAttribute("value");
//Time Left
TokenGrid["ExpiryTime", row].Value = DateTime.Now.AddMinutes(2).ToLongTimeString();