Exemplo n.º 1
0
 private void LlenarCampos()
 {
     try
     {
         Program.Evento = 1;
         P.Idtercero    = Program.Codigo;
         DataTable dt  = P.DatosProveedor();
         DataTable dt2 = P.DatosContacto();
         DataTable dt3 = P.DatosDireccion();
         txtNombre.Text                = dt.Rows[0][1].ToString();
         txtIdentificacion.Text        = dt.Rows[0][3].ToString();
         cbTipoProveedor.SelectedValue = dt.Rows[0][4].ToString();
         for (int x = 0; x < dt3.Rows.Count; x++)
         {
             dtgDireccion.Rows.Add(dt3.Rows[x][0]);
             dtgDireccion.Rows[x].Cells[0].Value = dt3.Rows[x][0].ToString();
             dtgDireccion.Rows[x].Cells[1].Value = dt3.Rows[x][1].ToString();
             dtgDireccion.Rows[x].Cells[2].Value = dt3.Rows[x][2].ToString();
             dtgDireccion.Rows[x].Cells[3].Value = dt3.Rows[x][3].ToString();
             dtgDireccion.Rows[x].Cells[4].Value = dt3.Rows[x][4].ToString();
         }
         for (int x = 0; x < dt2.Rows.Count; x++)
         {
             dtgContacto.Rows.Add(dt2.Rows[x][0]);
             dtgContacto.Rows[x].Cells[0].Value = dt2.Rows[x][0].ToString();
             dtgContacto.Rows[x].Cells[1].Value = dt2.Rows[x][1].ToString();
             dtgContacto.Rows[x].Cells[2].Value = dt2.Rows[x][2].ToString();
             dtgContacto.Rows[x].Cells[3].Value = dt2.Rows[x][3].ToString();
         }
     }
     catch (Exception ex)
     {
         MessageBoxEx.Show(ex.Message);
     }
 }