How do I collect address data (Street, City, Neighborhood, Street) for a site, referring to the input Cep using VB
?
I have a similar code in C#
I see two alternatives:
VB
c#
code from VB
to find the address and collect the results, storing them in textboxes
of address fill form in VB
, for instant visualization (do not know if it is possible) Someone could help with some of these alternatives above.
Code in C#
:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
string xml = "http://cep.republicavirtual.com.br/web_cep.phpcep=@cep&formato=xml"
.Replace("@cep",maskedTextBox1.Text);
DataSet ds = new DataSet();
ds.ReadXml(xml);
label1.Text = ds.Tables[0].Rows[0][1].ToString();
label3.Text= ds.Tables[0].Rows[0][5].ToString();
textBox2.Text = ds.Tables[0].Rows[0][6].ToString();
textBox3.Text = ds.Tables[0].Rows[0][4].ToString();
textBox4.Text = ds.Tables[0].Rows[0][3].ToString();
textBox5.Text = ds.Tables[0].Rows[0][2].ToString();
dataGridView1.DataSource = ds.Tables[0];
}
}
}