Populando GridView
Olá Pessoal,
Estou tentando popular um gridView em WinForms através do retorno de um Web Service e não estou conseguindo recuperar o retorno do WS. Segue o fonte
RETORNO DO WS
<?xml version="1.0" encoding="utf-8"?>
<Carros><retorno cdRetorno="0" />
<Carro Id="0000125" TipoCarro="Utilitario" Fabricante="GM" cLocalDaFabrica="A" IdRegiao="51" cNomedaRegiao="OESTE" EnderecodaFabrica="Av. Paulista, 30000" cBairro="Cerqueira Cesar" Cidade="SAO PAULO" cUF="SP" />
</Carros>
FONTE DO C# -- WinForms
using System;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Web.Services;
using System.IO;
using System.Xml;
namespace TesteWS
{
public partial class FORM1 : Form
{
public FORM1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
string caixa = txtCaixa.Text;
if (txtCaixa.Text == "" || rdPcc.Checked== false && rdTerm.Checked == false)
{
MessageBox.Show("PREENCHA O CAMPO E SELECIONA O TIPO DE PESQUISA","AVISO DE COISA ERRADA");
txtCaixa.Focus();
}
else
{
fechadura.Terminais wsFech = new fechadura.Terminais();
if (rdPcc.Checked == true)
{
try
{
txtRetorno.Text = wsFech.RetornaTerminaisPorPCC(caixa);
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString(),"ERRO INTERNO");
}
}
else
{
DataTable fech = new DataTable();
if (fech.Rows.Count == 0)
{MessageBox.Show("NÃO EXISTE DADOS PARA ESTE PARÂMETRO","RETORNO DA CONSULTA");}
else
{
txtRetorno.Text = "";
txtRetorno.Text = wsFech.RetornaTerminal(caixa);
}
}
}
}
private void btnLimpa_Click(object sender, EventArgs e)
{
txtRetorno.Text = "";
}
}
}
Agradeço pela força
Discussão (3)
Carregando comentários...