protected void BtnAddComment_Click(object sender, EventArgs e) { if (tbAddComment.Text != string.Empty) { int highestCommentID = 0; foreach (Comment c in Comments) { if (c.CommentID >= highestCommentID) { highestCommentID = c.CommentID + 1; } } Comment newcomment = new Comment(highestCommentID, CurrentVideo, tbAddComment.Text, CurrentUser); lblErrorMessages.Text = databaseManager.AddComment(CurrentVideo, newcomment); AddComments(); } }