0
No error but the data doesn't display in the listbox. :( sorry for the trouble. i'm not good in codings.
0
Hope this will work.
foreach(char str in e.result)
{
listBox1.Items.Add(str.ToString());
}
0
Hi Pravin,
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?)
0
hi sarah ,
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.
0
Hi Pravin, i have alrdy done that in my web service. The problem is i'm using web client method so i think i'm supposed to use the XDocument to help retrieve the data to the listbox successfully. i cant seems to retrieve the data from database :(
this is how my codings in xaml.cs look like:
public Details
{
InitializeComponent();WebClient proxy = new WebClient();
string baseUri = "http://localhost:1723/ServiceImpl.svc/GetDetails";
proxy.DownloadStringCompleted += new DownloadStringCompletedEventHandler(proxy_DownloadStringCompleted);
proxy.DownloadStringAsync(new Uri(baseUri));
}
void proxy_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e)
{
if (e.Error != null)
{ return; }
if (e.Result == null)
MessageBox.Show("NUlllllllllll");
XDocument xmlCurrent = XDocument.Parse(e.Result);
ListBox.DataContext = xmlCurrent;
}
0
Hi Sarah,
you can return List<string> from your web service and bind it to listbox.
i.e. return type of service will be List<string>