listview problem
-
hi.. i have a question related to the listview.. i did the below things.. but how do i assign the value to the listview /?
void call_listview()
{
cmd.Connection = con;
cmd.CommandText = "select * from contact";
da.SelectCommand = cmd;DataTable store = new DataTable(); try { ds.Clear(); con.Open(); da.Fill(ds); store = ds.Tables\[0\]; int count\_friend = store.Rows.Count; contact\_total\_friends.Content = count\_friend; contact\_listview.DataContext = ds.Tables\[0\].DefaultView; } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { con.Close(); } }
-
hi.. i have a question related to the listview.. i did the below things.. but how do i assign the value to the listview /?
void call_listview()
{
cmd.Connection = con;
cmd.CommandText = "select * from contact";
da.SelectCommand = cmd;DataTable store = new DataTable(); try { ds.Clear(); con.Open(); da.Fill(ds); store = ds.Tables\[0\]; int count\_friend = store.Rows.Count; contact\_total\_friends.Content = count\_friend; contact\_listview.DataContext = ds.Tables\[0\].DefaultView; } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { con.Close(); } }
Have you looked at any articles on this site regarding ListView databinding? A quick search reveals Data binding a ListView[^]
Life, family, faith: Give me a visit. From my latest post: "And you think, 'To keep my anti-Judaic theology alive I must reinterpret this verse too as being a blessing for Christians and not for Jews. I know it strains all manner of principles of interpretation. I don’t read the newspaper this sloppily, but, man, I have a theology to defend.'" Judah Himango