Error nya nongol di mana? Rgds,
On 2011-09-03, abdullah muhammad <[email protected]> wrote: > > mohon bantuannya untuk parsing Json, satu minggu ini saya sdh coba googling > dan cari ref tapi problemnya blom beres. mohon bantuannya letak kesalahannya > dimana.. > oiya, selalu muncul error: InvalidCastException > > > namespace KisahBijakApp > { > public partial class KumpulanKisah : PhoneApplicationPage > { > > public KumpulanKisah() > { > InitializeComponent(); > } > > > [DataContract] > public class detailedAddress > { > > [DataMember] > public int id_kisah { get; set; } > > [DataMember] > public string judul { get; set; } > > [DataMember] > public string preview { get; set; } > > [DataMember] > public string pengarang { get; set; } > > > public detailedAddress[] addresses; > } > > private void btnDownload_Click(object sender, RoutedEventArgs e) > { > try > { > WebClient client = new WebClient(); > client.OpenReadCompleted += new > OpenReadCompletedEventHandler(client_OpenReadCompleted); > client.OpenReadAsync(new > Uri("http://labs.abdullah21.net/api/show_all_kisah.php"), UriKind.Absolute); > } > catch(Exception ex) > { > MessageBox.Show(ex.Message); > } > } > > void client_OpenReadCompleted(object sender, > OpenReadCompletedEventArgs e) > { > try > { > var serializer = new > DataContractJsonSerializer(typeof(detailedAddress)); > detailedAddress data = > (detailedAddress)serializer.ReadObject(e.Result); > > for (int i = 0; i <= data.addresses.Length - 1; i++) > { > > LBDetailKisah.Items.Add(data.addresses[i].judul.ToString()); > > LBDetailKisah.Items.Add(data.addresses[i].pengarang.ToString()); > LBDetailKisah.Items.Add("-----------------"); > > } > } > catch (Exception ex) > { > MessageBox.Show(ex.Message); > } > } > } > } > > > Makasih sebelumnya ;) > > Salam, > > Abdullah > > hhtp://abdullah21.wordpress.com > -------------------------------------------- > Twitter || Fb || Koprol || ==> abdullah21 > -- -- Pandu E Poluan - IT Optimizer My website: http://pandu.poluan.info/ _______________________________________________ To unsubscribe from this group, send an email to: [email protected] Get Free 5 GB mailbox Check this http://www.mugi.or.id Powered by bisnismedia.com www.x-phones.com (all about ponsel)
