Friday, 24 May 2013

how to copy from a list to another list

 private void UserControl1_Load(object sender, EventArgs e)
        {
            try
            {
                 List<emp> s = o.EMP1s.Select(x => new emp { EID = x.EID, NAME = x.NAME }).ToList();
                 dataGridView1.DataSource = s;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message.ToString());
            }
        }
        public class emp
        {
            public int EID
            {
                get;
                set;
            }
            public string NAME
            {
                get;
                set;
            }
        }

No comments:

Post a Comment