Ver Mensaje Individual
  #1 (permalink)  
Antiguo 04/10/2010, 09:53
th3r0rn
 
Fecha de Ingreso: noviembre-2007
Mensajes: 504
Antigüedad: 16 años, 6 meses
Puntos: 2
Problema con IF en c#

Hola tengo el siguiente codigo:
Código C#:
Ver original
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Text;
  7. using System.Windows.Forms;
  8.  
  9. namespace VigilanciaPG
  10. {
  11.     public partial class frmControl : Form
  12.     {
  13.         public frmControl()
  14.         {
  15.             InitializeComponent();
  16.         }
  17.  
  18.         private void btnBuscar_Click(object sender, EventArgs e)
  19.         {
  20.             DataSet dtbRegistro = clsFunciones.dtGetDataSet("Select * from tbEmpleados where StrImss='" + txtBuscar.Text + "'");
  21.             txtAPaterno.Text = dtbRegistro.Tables[0].Rows[0]["strAPaterno"].ToString();
  22.             txtAMaterno.Text = dtbRegistro.Tables[0].Rows[0]["strAMaterno"].ToString();
  23.             txtNombre.Text = dtbRegistro.Tables[0].Rows[0]["strNombre"].ToString();
  24.             txtCURP.Text = dtbRegistro.Tables[0].Rows[0]["strCURP"].ToString();
  25.             txtIMSS.Text = dtbRegistro.Tables[0].Rows[0]["strImss"].ToString();
  26.             String validar;
  27.             validar = dtbRegistro.Tables[0].Rows[0]["strStatus"].ToString();
  28.             if  (validar = "A" )
  29.             {
  30.                 pictureBox2.Image = Image.FromFile("C:\\Documents and Settings\\BW9648\\Desktop\\VigilanciaPG\\VigilanciaPG\\VigilanciaPG\\Resources\\semaforo_verde.jpg");
  31.             }
  32.            
  33.  
  34.         }
  35.  
  36.      
  37.  
  38.      
  39.     }
  40. }
Pero me da error en el if : if (validar = "A" ) Cannot explit convert type String to Bool, Dejo una captura de pantalla en el siguiente link:
http://ompldr.org/vNXB6aA
Saludos