2
How do I collect address data(Street, City, Neighborhood, Street) of a site, referring to the entry zip code using VB
?
I have a similar code on C#
I see two alternatives:
- Translate the code to
VB
- Execute the code of
c#
from theVB
to find the address and collect the results, storing them intextboxes
of the address form atVB
, for instant display (I don’t know if it’s possible)
Could anyone 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];
}
}
}
Put this o using System inside all code, formatting in an ideal way
– user6026
The conversion worked ?
– user6026