WhatsAppNETClient / WhatsAppNETClient2

32 stars 23 forks source link

Konversi ke ListItem #18

Closed asyad85 closed 2 years ago

asyad85 commented 2 years ago

salam mas Rudi, saya mau tanya. Gimana cara konversi DataTable ke ListItem atau ButtonItem ya? tks mas

var section = new Section { title = clist1.GetRecords.Rows[0]["subtitle"].ToString().Trim(), items = new ListItem[] { new ListItem { title = "Berzakat", description = "Zakal maal, zakat fitrah, dll" }, new ListItem { title = "Berinfak", description = "Infak pendidikan, infak kesehatan, dll" }, new ListItem { title = "Bantuan", description = "Klo masih bingung" } } };

WhatsAppNETClient commented 2 years ago

@asyad85

Emang isi DataTablenya apa om?

asyad85 commented 2 years ago

Saya coba buat pilihan dengan isi DataTable seperti contoh diatas Mas, saya sudah menggunakan looping tp syntax error

var section = new Section { title = clist1.GetRecords.Rows[0]["subtitle"].ToString().Trim(), items = new ListItem[] { for (int i = 0; i <= clist1.GetRecords.Rows.Count - 1; i++) { new ListItem { title = clist1.GetRecords.Rows[i]["title"].ToString(), description = clist1.GetRecords.Rows[i]["description"].ToString() }, } } };

mohon solusinya Mas, tks

WhatsAppNETClient commented 2 years ago

@asyad85

Coba pake array dulu om

asyad85 commented 2 years ago

iya mas terima kasih sarannya, saya coba dulu ya