Click here to Skip to main content
15,746,534 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hello there. I have a class with bind list here:
class StafkiProperties
        public string TarifenModel { set; get; }
        public string Artikl { set; get; }
        public string kolicina { set; get; }
        public string kolicinaMerka { set; get; }
        public int VrednostNaMaterijali { set; get; }
        public string ValutaMaterijal { set; get; }
        public string DavackiRazdolzuvanje { set; get; }
        public BindingList<stafkiproperties> Stavki { set; get; }
And this properties are filled with some data : 

 public  BindingList<stafkiproperties> GetVrednost()
            BindingList<stafkiproperties> max = new BindingList<stafkiproperties>();
                while (max.Count() < 55)
                    max.Add(new StafkiProperties
                        TarifenModel = (620190021).ToString(),
                        Artikl = "СИНТЕТИКА/ПАМУК",
                        kolicina = (72).ToString(),
                        kolicinaMerka = "PCS",
                        VrednostNaMaterijali = 50,
                        ValutaMaterijal = "EUR",
                        DavackiRazdolzuvanje = (7512).ToString()


But when i try to make instance of class i cannot set this list as a datasource of data grid view, any help please?
StafkiProperties st = new StafkiProperties();
             // Stavki = new StafkiProperties();
             // BindingList<stafkiproperties> Stavki;
              dt.Rows[i]["Р.Бр."] =
              dt.Rows[i]["Модел"] = st.Stavki;
              dt.Rows[i]["Налог"] = st.Stavki;
              dt.Rows[i]["Количина"] = st.Stavki;
              dt.Rows[i]["PCS"] = st.Stavki;
              dt.Rows[i]["Цена"] = st.Stavki;
              dt.Rows[i]["Вез"] = st;
              dt.Rows[i]["Додаток"] = st;
              totalAmtStr += (i + 1);
              dataGridView1.DataSource = dt;
Updated 23-Jun-15 23:14pm

1 solution

I'm missing where dt is declared but it seems to me that you want to set the DataSource to a binding list? st.GetVerdnost() returns a binding list. Can you set the data source to st.GetVerdnost?
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900