Foros del Web » Programación para mayores de 30 ;) » .NET »

Ayuda con un ComboBox

Estas en el tema de Ayuda con un ComboBox en el foro de .NET en Foros del Web. cordial saludo amigos del foro tengo un pequeña duda, estoy realizando un programita donde tengo un combobox llamado cmbidafiliado, un textbox llamado txtnumafiliado y un ...
  #1 (permalink)  
Antiguo 24/05/2010, 23:16
 
Fecha de Ingreso: diciembre-2009
Mensajes: 137
Antigüedad: 14 años, 4 meses
Puntos: 4
Busqueda Ayuda con un ComboBox

cordial saludo amigos del foro

tengo un pequeña duda, estoy realizando un programita donde tengo un combobox llamado cmbidafiliado, un textbox llamado txtnumafiliado y un datetimepicker llamado DtpFechnac. la ayuda q solicito es que necesito validar cuando presiono el combobox y selecciono un item y cuando no lo presiono. mi pregunta es q metodo uso para realizar esa validacion

gracias por su atencion prestada espero q me colaboren
  #2 (permalink)  
Antiguo 25/05/2010, 10:27
Avatar de Darkavender  
Fecha de Ingreso: septiembre-2008
Ubicación: SLV
Mensajes: 125
Antigüedad: 15 años, 7 meses
Puntos: 4
Respuesta: Ayuda con un ComboBox

Cita:
cmbidafiliado_SelectedIndexChanged
  #3 (permalink)  
Antiguo 25/05/2010, 19:27
 
Fecha de Ingreso: diciembre-2009
Mensajes: 137
Antigüedad: 14 años, 4 meses
Puntos: 4
Respuesta: Ayuda con un ComboBox

Bueno aca estuve realizando el codigo pero me genera un problema, el combobox cmbidafiliado tienes los sgtes item: AS,RC,CC,TI, cada vez q cargo el formulario siempre me toma el AS como el primer item, como hago q el me tome el valor actual ejemplo cuando tenga un registro q contega CC

aca te muestro un mi codigo

Código:

Private Sub FrmActualizarNovedad_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
 Try
            Dim TxtValor As String
            'validacion de combobox 0 y 1
            cmbIdafiliado.Text = cmbIdafiliado.Items(0)            
            swCambio = False
            'txtValorAnt = cmbIdafiliado.Text
Catch ex As Exception

        End Try
    End Sub

 Private Sub cmbIdafiliado_SelectedValueChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmbIdafiliado.SelectedValueChanged
        Try
            swCambio = txtValorAnt <> cmbIdafiliado.Text
        Catch ex As Exception

        End Try
    End Sub

 Private Sub cmdGrabar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdGrabar.Click
        Dim rsDatosF As New ADODB.Recordset
        Dim Fechita As String = FechaActual()

If swCambio Then
                            con.Execute("UPDATE RS.RSNOVEDAD SET CODENTIDAD='" & txtEntidad.Text & "', APELLIDO1='" & Me.txtApellido1.Text & "',APELLIDO2='" & Me.txtApellido2.Text & "',NOMBRE1='" & Me.txtNombre1.Text & "',NOMBRE2='" & Me.txtNombre2.Text & "',CODDPTO='" & Me.txtDpto.Text & "',CODMPIO='" & Me.txtMunicipio.Text & "',CODNOVEDAD='" & Me.cmbNovedad.Text & "',FECININOV='" & FechaAMD(Fechita) & "',N1='" & Me.cmbIdafiliado.Text & "',N2='" & Me.txtNumidafiliado.Text & "',N3='" & FechaDMA(DtpFechnac.Text) & "',N4='0' WHERE CODIGO=" & LngReg)
                            con.Execute("UPDATE RS.RSUBSIDIADO SET CODENTIDAD='" & txtEntidad.Text & "',TIPIDCABFAM='" & cmbTipidcabfam.Text & "',NUMIDCABFAM='" & txtNumidcab.Text & "',TIPAFILIADO='" & cmbIdafiliado.Text & "',NUMAFILIADO='" & txtNumidafiliado.Text & "',APELLIDO1='" & txtApellido1.Text & "',APELLIDO2='" & txtApellido2.Text & "',NOMBRE1='" & txtNombre1.Text & "',NOMBRE2='" & txtNombre2.Text & "',FECHANAC='" & DtpFechnac.Text & "',SEXOAFI='" & cmbSexo.Text & "',TIPOAFI='" & cmbTipafiliado.Text & "',PARCABFAM='" & cmbParentezco.Text & "',GRUPOBLA='" & txtGrupo.Text & "',NIVSISBEN='" & cmbNivel.Text & "',NUMFICSISBEN='" & txtFicha.Text & "',CODBENMAYOR='" & cmbCondicion.Text & "',CODDPTOAFI='" & txtDpto.Text & "',CODMUNAFI='" & txtMunicipio.Text & "',ZONAFI='" & cmbZona.Text & "',FAFISGSSS='" & DtpFecSGSSS.Text & "',FAFIENTIDAD='" & DtpFecafient.Text & "',NUMCONTRATO='" & txtNumContrato.Text & "',FECINICONTRATO='" & DtpFecinContrato.Text & "',TIPCONTRATO='" & cmbTipContrato.Text & "',PERTETNICA='" & txtEtnia.Text & "',MODASUBSIDIO='" & cmbModalidad.Text & "' WHERE CONSECUTIVO=" & txtConsecutivo.Text)
                            sbMensaje.Text = "Registro Actualizado"
                            Cerrar(rsDatosF)
                            rsDatosF.Open("SELECT * FROM RSUBSIDIADO WHERE CONSECUTIVO='" & txtConsecutivo.Text & "'", con, ADODB.CursorTypeEnum.adOpenDynamic, ADODB.LockTypeEnum.adLockOptimistic)
                            cmdSalir.Enabled = True
                            cmdCancelar.Enabled = False
                            cmdGrabar.Enabled = False
                        Else
                            con.Execute("UPDATE RS.RSNOVEDAD SET CODENTIDAD='" & txtEntidad.Text & "', APELLIDO1='" & Me.txtApellido1.Text & "',APELLIDO2='" & Me.txtApellido2.Text & "',NOMBRE1='" & Me.txtNombre1.Text & "',NOMBRE2='" & Me.txtNombre2.Text & "',CODDPTO='" & Me.txtDpto.Text & "',CODMPIO='" & Me.txtMunicipio.Text & "',CODNOVEDAD='" & Me.cmbNovedad.Text & "',FECININOV='" & FechaAMD(Fechita) & "',N1='" & Me.cmbIdafiliado.Text & "',N2='" & Me.txtNumidafiliado.Text & "',N3='" & FechaDMA(DtpFechnac.Text) & "',N4='1' WHERE CODIGO=" & LngReg)
                            con.Execute("UPDATE RS.RSUBSIDIADO SET CODENTIDAD='" & txtEntidad.Text & "',TIPIDCABFAM='" & cmbTipidcabfam.Text & "',NUMIDCABFAM='" & txtNumidcab.Text & "',TIPAFILIADO='" & cmbIdafiliado.Text & "',NUMAFILIADO='" & txtNumidafiliado.Text & "',APELLIDO1='" & txtApellido1.Text & "',APELLIDO2='" & txtApellido2.Text & "',NOMBRE1='" & txtNombre1.Text & "',NOMBRE2='" & txtNombre2.Text & "',FECHANAC='" & DtpFechnac.Text & "',SEXOAFI='" & cmbSexo.Text & "',TIPOAFI='" & cmbTipafiliado.Text & "',PARCABFAM='" & cmbParentezco.Text & "',GRUPOBLA='" & txtGrupo.Text & "',NIVSISBEN='" & cmbNivel.Text & "',NUMFICSISBEN='" & txtFicha.Text & "',CODBENMAYOR='" & cmbCondicion.Text & "',CODDPTOAFI='" & txtDpto.Text & "',CODMUNAFI='" & txtMunicipio.Text & "',ZONAFI='" & cmbZona.Text & "',FAFISGSSS='" & DtpFecSGSSS.Text & "',FAFIENTIDAD='" & DtpFecafient.Text & "',NUMCONTRATO='" & txtNumContrato.Text & "',FECINICONTRATO='" & DtpFecinContrato.Text & "',TIPCONTRATO='" & cmbTipContrato.Text & "',PERTETNICA='" & txtEtnia.Text & "',MODASUBSIDIO='" & cmbModalidad.Text & "' WHERE CONSECUTIVO=" & txtConsecutivo.Text)
                            sbMensaje.Text = "Registro Actualizado"
                            Cerrar(rsDatosF)
                            rsDatosF.Open("SELECT * FROM RSUBSIDIADO WHERE CONSECUTIVO='" & txtConsecutivo.Text & "'", con, ADODB.CursorTypeEnum.adOpenDynamic, ADODB.LockTypeEnum.adLockOptimistic)
                            cmdSalir.Enabled = True
                            cmdCancelar.Enabled = False
                            cmdGrabar.Enabled = False
                        End If
End sub
 
lo q requiero es q tome el valor actual q correspone al combobox y cuando sea seleccionado algun item del combobox ingrese en el if q esta dentro del boton y cuando no sea seleccionado entre al else

Etiquetas: combobox
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 01:00.