Hi people, may i know how can i retrieve data from database(linq to sql) using webclient and display in listbox? I realied most of the articles talk about creating xml file and use XDocument or XElement. Is there any possibility that i can consume the web service and retrieve the data?
Urgent. People please help me :(
Loading
SarahPosted Nov 19, 2011, 11:07 AM
Prabhu RajaPosted Nov 19, 2011, 7:21 AM
foreach(char str in e.result)
{
listBox1.Items.Add(str.ToString());
}
SarahPosted Nov 19, 2011, 3:20 AM
the codes doesnt work well.
error for foreach: Cannot convert type 'char' to 'string'.
error for ListBox.Add(str); : Error 1 'System.Windows.Controls.ListBox' does not contain a definition for 'Add' and no extension method 'Add' accepting a first argument of type 'System.Windows.Controls.ListBox' could be found (are you missing a using directive or an assembly reference?)
Pravin MorePosted Nov 18, 2011, 2:03 AM
ok then you can add it by foreach.......
try like this...
foreach(string str in e.result)
{
listBox1.Add(str);
}
note:- i hope you can do any typecast or to list if required.
let me know if works or not.
Thanks,
Pravin.
SarahPosted Nov 18, 2011, 1:05 AM
this is how my codings in xaml.cs look like:
Pravin MorePosted Nov 17, 2011, 11:45 PM
you can return List
i.e. return type of service will be List