Adding Class instance as a new Row in DataGridView (c#)

Posted by Amit Shah on Stack Overflow See other posts from Stack Overflow or by Amit Shah
Published on 2011-01-05T09:48:33Z Indexed on 2011/01/05 9:53 UTC
Read the original article Hit count: 282

Hi All,
I have a class say

[Serializable]
    public class Answer
    {
        [DisplayName("ID")]
        public string ID { get; set; }
        [DisplayName("Value")]
        public string Value { get; set; }
    }

and I have a datagridview with bounded columns to the above class.

instances of this class Answer are created dynamically as and when required. How do I update datagridview when each and every instance of class is created.

is it possible to do something of this sort.

dataGridView.Rows.Add(classInstance);

Thanks in Advance,
Amit

© Stack Overflow or respective owner

Related posts about visual-studio

Related posts about visual-studio-2008