Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Net;
- using Newtonsoft.Json;
- private void btnPesquisar_Click(object sender, EventArgs e)
- {
- WebClient client = new WebClient();
- string myJSON = client.DownloadString("https://viacep.com.br/ws/" + txbCEP.Text + "/json/");
- var end = JsonConvert.DeserializeObject<Endereco>(myJSON);
- txbLogradouro.Text = end.logradouro;
- txbComplemento.Text = end.complemento;
- txbBairro.Text = end.bairro;
- txbLocalidade.Text = end.localidade;
- txbDDD.Text = end.ddd;
- txbUF.Text = end.uf;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement