I have a datasource that I want to bind to a listview that has multiple columns. How do I bind my datasource to that listview
Here is some pseudo code that doesn't work to help illustrate what I am trying to do:
MyDataTable dt = GetDataSource();
ListView1.DataBindings.Add("Column1.Text", dt, "MyDBCol1");
ListView1.DataBindings.Add("Column2.Text", dt, "MyDBCol2");
-- edit --
Sorry, I forgot to mention it was winforms.
It seems there is a lacuna in functionality of WinForms ListView control (thought it's possible to databind new WPF ListBox).
This article by Nick Karnik describes how to add databinding capability to custom control inherited from WinForms ListView - Data binding a ListView.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With