DataGridView and binding with BindingList<T> and DataSource
Hey there. I'm trying to simplify a bit my use of DataGridView (I am currently adding manually all the items but I would like that to be done automatically).
I've googled quite a bit and I haven't found the answer to my problem. Basically, I am almost copy-pasting this bit from tutorials (the only thing that changes is the name of my variables and text and such) and on my computer nothing shows up (well the dgv does show up, but empty).
I tried using the simplest code possible and I still get nothing:
I know the event is triggered because I only commented code that was working (but more verbose and manual) to try this method. I'm quite lost here. I've tried replacing BindingList<T> to List<T> (actually it's the other way around, I had List<T> first). I also tried using only strings instead of Serie object, but for some weird reason it would use the last column and output the number of characters in each strings :\ !
private void openAllToolStripMenuItem_Click(object sender, EventArgs e)
dataGridView2.AutoGenerateColumns = true;
BindingList<Serie> ls = new BindingList<Serie>();
ls.Add(new Serie("blablabla", "1234", 2));
ls.Add(new Serie("blablabla2", "12345", 2));
ls.Add(new Serie("blablabla3", "123456", 2));
bs.DataSource = ls;
dataGridView2.DataSource = bs;