elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Rompecabezas de Bitcoin, Medio millón USD en premios


  Mostrar Temas
Páginas: [1]
1  Programación / .NET (C#, VB.NET, ASP) / Boton buscar Vb.net en: 28 Agosto 2010, 22:22 pm
Hola, tenia tiempo sin pasar por aca. Soy nuevo en vb.net vengo de vb 6.0 y ps como sabran el codigo cambia notablemente.

Necesito programar un botón de buscar que me traiga registros de una base  de datos en acces 2003 a las cajas de texto que tengo en la pantalla, y que en esa misma pantalla pueda modificar el registro con un boton de actualizar.
Código
  1. Para el boton de buscar el codigo q tengo es el siguiente
  2. Código:
  3. Dim cn As OleDbConnection
  4.        Dim cmd As OleDbCommand
  5.        Dim dr As OleDbDataReader
  6.        Try
  7.            cn = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=bd.mdb;")
  8.            'provider to be used when working with access database
  9.            cn.Open()
  10.            cmd = New OleDbCommand("select * from registro", cn)
  11.            dr = cmd.ExecuteReader
  12.            While dr.Read()
  13.                txtcedula.Text = dr(0)
  14.                txtnombres.Text = dr(1)
  15.                txtapellidos.Text = dr(2)
  16.                txtempresa.Text = dr(3)
  17.                txtubicacion.Text = dr(4)
  18.                txttelefono.Text = dr(5)
  19.                txttutor.Text = dr(6)
  20.                cmbespecialidad.Text = dr(7)
  21.                txtseccion.Text = dr(8)
  22.                ' loading data into TextBoxes by column index
  23.            End While
  24.  
  25.        Catch
  26.        End Try
  27.        dr.Close()
  28.        cn.Close()
  29.    End Sub
  30.  
  31.  
pero este codigo solo me trae los datos del  1er registro de la tabla yo quisiera que al meter el campo clave en la caja de texto me consulte y me traiga los demas datos de ese registro en específico.

Gracias de antemano.
2  Programación / Programación Visual Basic / Menor valor en una columna de un Msflexgrid en: 23 Octubre 2009, 19:29 pm
Hola necesito una pequeña ayudita----
Resulta q tengo un msflexgrid y necesito saber o mejor dicho calcular el menor valor en una de las columnas para poder asociarlo a otros valores de la misma fila... (Tramo A-B   por ejemplo)....  tengo la idea con un for pero no me sirve a lo mejor lo estoy planteando mal

Código:
For i = 1 To msflexgrid1.rows -1
Dim s As Integer
s = i + 1
If Val(MSFlexGrid1.TextMatrix(i, 5)) < Val(MSFlexGrid1.TextMatrix(s, 5)) Then
Text2.Text = MSFlexGrid1.TextMatrix(i, 0) & " - " & MSFlexGrid1.TextMatrix(i, 1)
Else
Text2.Text = MSFlexGrid1.TextMatrix(s, 0) & " - " & MSFlexGrid1.TextMatrix(s, 1)
End If
'Next i

Espero me ayuden.. gracias de antemano
3  Programación / Programación Visual Basic / Problema con maxima cantidad de controles en formulario! en: 16 Octubre 2009, 05:21 am
Hola
Necesito ayuda con un problemilla, Resulta que estoy en un formulario y al parecer he usado muchos controles y me tira el siguiente error: "Se alcanzo el limite: no se pueden crear mas controles para el formulario" :S

Que puedo hacer para solucionarlo? necesito meter mas controles... Alguna idea..
Ayuida urgente pls..
Gracias de antemano
4  Programación / Programación Visual Basic / Sin espacio en Formulario en: 14 Octubre 2009, 23:27 pm
Hola a todos....
Quisiera una pequeña ayuda para hacer algo que me tiene trancado con un proyecto que estoy haciendo pero no encuentro la manera de hacerlo...

La cosa es asi tengo una pantalla y ahi necesito crear unas tablas... como esta que esta en la foto



Pero el problema es que son 3 como esa y no va a caber en un formulario... y no quiero hacerlo en varios porque seria muy tedioso ya que son 30 panatallas iguales...  como podria yo hacer que quepan las 3 tablas? tenia pensado meterlas en algun control y crear un scroll bar para que quepan las 3 pero no se como hacerlo.... tambien queria preguntar si la pantalla se podria alargar mas con un scrollbar.. o sea alargar mas del alto máximo...   necesito que sean textbox porque es lo que me sirve para lo que quiero hacer.. por eso no he probado con ningun tipo de grid...

Por favor si me pueden dar una ayuda.. ideas.. algo se los agradezco
5  Programación / Programación Visual Basic / comoparar pares de celdas en control msflexgrid en: 9 Agosto 2009, 00:33 am
Hola a todos...
Tengo un problemilla que le he dado vueltas y no he podido resolver...

resulta que tengo 2 msflexgrid en form diferentes.  en el form1 el msflexgrid tiene de columnas NI(nodo inicial), NF(nodo final) y Logintud.   Cabe destacar que en el form1 hay 1 textbox y un boton y depende de la cantidad que meta en el textbox y apriete el boton saldran tantas filas como haya introducido en el textbox....( eso ya lo tengo solucionado) seguimos con el problema  en el msflexgrid del form2 tambien tengo las mismas columnas (NI,NF,longitud) y hace lo mismo con el textbox pero en este caso el numero de filas puede ser menor o igual al numero de filas del msflexgrid del form 1...    la pregunta es la siguiente:

Como hago para comparar als columnas NI y NF(esas 2 comlumnas) del msflexgrid del form1 con las columnas NI y NF y depende de si son iguales o no traerme la longitud de la columna del msdflexgrid del form1 al msflexgrid del form2...

Nota: en el form1 los datos a  introducir son NI , ND y longitud y en el form2 solo introduzco el NI y NF y al apretar un boton la longitud me la deberia traer del msflexgrid del form1..

Aqui adjunto el codigo con el que he tratado...
He hecho con 2 for pero me da el mismo resultado he aqui el primer code que use.
Código:
Private Sub longitud()
For i = 1 To Val(Text1.Text)

If frmtramos.MSFlexGrid1.Rows > 0 And Text1.Text > 0 Then
If MSFlexGrid1.TextMatrix(i, 0) = frmtramos.MSFlexGrid1.TextMatrix(1, 1) And MSFlexGrid1.TextMatrix(i, 1) = frmtramos.MSFlexGrid1.TextMatrix(1, 2) Then
MSFlexGrid1.TextMatrix(i, 2) = frmtramos.MSFlexGrid1.TextMatrix(1, 3)
 Else
 If frmtramos.MSFlexGrid1.Rows > 1 And Text1.Text > 1 Then
  If MSFlexGrid1.TextMatrix(i, 0) = frmtramos.MSFlexGrid1.TextMatrix(2, 1) And MSFlexGrid1.TextMatrix(i, 1) = frmtramos.MSFlexGrid1.TextMatrix(2, 2) Then
  MSFlexGrid1.TextMatrix(i, 2) = frmtramos.MSFlexGrid1.TextMatrix(2, 3)
  
   Else
   If frmtramos.MSFlexGrid1.Rows > 2 And Text1.Text > 2 Then
    If MSFlexGrid1.TextMatrix(i, 0) = frmtramos.MSFlexGrid1.TextMatrix(3, 1) And MSFlexGrid1.TextMatrix(i, 1) = frmtramos.MSFlexGrid1.TextMatrix(3, 2) Then
    MSFlexGrid1.TextMatrix(i, 2) = frmtramos.MSFlexGrid1.TextMatrix(3, 3)
    
     Else
      If frmtramos.MSFlexGrid1.Rows > 3 And Text1.Text > 3 Then
       If MSFlexGrid1.TextMatrix(i, 0) = frmtramos.MSFlexGrid1.TextMatrix(4, 1) And MSFlexGrid1.TextMatrix(i, 1) = frmtramos.MSFlexGrid1.TextMatrix(4, 2) Then
       MSFlexGrid1.TextMatrix(i, 2) = frmtramos.MSFlexGrid1.TextMatrix(4, 3)
      
      Else
       If frmtramos.MSFlexGrid1.Rows > 4 And Text1.Text > 4 Then
        If MSFlexGrid1.TextMatrix(i, 0) = frmtramos.MSFlexGrid1.TextMatrix(5, 1) And MSFlexGrid1.TextMatrix(i, 1) = frmtramos.MSFlexGrid1.TextMatrix(5, 2) Then
        MSFlexGrid1.TextMatrix(i, 2) = frmtramos.MSFlexGrid1.TextMatrix(5, 3)
        
       Else
        If frmtramos.MSFlexGrid1.Rows > 5 And Text1.Text > 5 Then
         If MSFlexGrid1.TextMatrix(i, 0) = frmtramos.MSFlexGrid1.TextMatrix(6, 1) And MSFlexGrid1.TextMatrix(i, 1) = frmtramos.MSFlexGrid1.TextMatrix(6, 2) Then
         MSFlexGrid1.TextMatrix(i, 2) = frmtramos.MSFlexGrid1.TextMatrix(6, 3)
        
        Else
         If frmtramos.MSFlexGrid1.Rows > 6 And Text1.Text > 6 Then
         If MSFlexGrid1.TextMatrix(i, 0) = frmtramos.MSFlexGrid1.TextMatrix(7, 1) And MSFlexGrid1.TextMatrix(i, 1) = frmtramos.MSFlexGrid1.TextMatrix(7, 2) Then
         MSFlexGrid1.TextMatrix(i, 2) = frmtramos.MSFlexGrid1.TextMatrix(7, 3)
        
          Else
           If frmtramos.MSFlexGrid1.Rows > 7 And Text1.Text > 7 Then
            If MSFlexGrid1.TextMatrix(i, 0) = frmtramos.MSFlexGrid1.TextMatrix(8, 1) And MSFlexGrid1.TextMatrix(i, 1) = frmtramos.MSFlexGrid1.TextMatrix(8, 2) Then
            MSFlexGrid1.TextMatrix(i, 2) = frmtramos.MSFlexGrid1.TextMatrix(8, 3)
            
             Else
              If frmtramos.MSFlexGrid1.Rows > 8 And Text1.Text > 8 Then
                If MSFlexGrid1.TextMatrix(i, 0) = frmtramos.MSFlexGrid1.TextMatrix(9, 1) And MSFlexGrid1.TextMatrix(i, 1) = frmtramos.MSFlexGrid1.TextMatrix(9, 2) Then
                MSFlexGrid1.TextMatrix(i, 2) = frmtramos.MSFlexGrid1.TextMatrix(9, 3)
                
                 Else
                  If frmtramos.MSFlexGrid1.Rows > 9 And Text1.Text > 9 Then
                    If MSFlexGrid1.TextMatrix(i, 0) = frmtramos.MSFlexGrid1.TextMatrix(10, 1) And MSFlexGrid1.TextMatrix(i, 1) = frmtramos.MSFlexGrid1.TextMatrix(10, 2) Then
                    MSFlexGrid1.TextMatrix(i, 2) = frmtramos.MSFlexGrid1.TextMatrix(10, 3)
                    
                        Else
                         If frmtramos.MSFlexGrid1.Rows > 10 And Text1.Text > 10 Then
                            If MSFlexGrid1.TextMatrix(i, 0) = frmtramos.MSFlexGrid1.TextMatrix(11, 1) And MSFlexGrid1.TextMatrix(i, 1) = frmtramos.MSFlexGrid1.TextMatrix(11, 2) Then
                            MSFlexGrid1.TextMatrix(i, 2) = frmtramos.MSFlexGrid1.TextMatrix(11, 3)
                          Else
                           If frmtramos.MSFlexGrid1.Rows > 11 And Text1.Text > 11 Then
                             If MSFlexGrid1.TextMatrix(i, 0) = frmtramos.MSFlexGrid1.TextMatrix(12, 1) And MSFlexGrid1.TextMatrix(i, 1) = frmtramos.MSFlexGrid1.TextMatrix(12, 2) Then
                             MSFlexGrid1.TextMatrix(i, 2) = frmtramos.MSFlexGrid1.TextMatrix(12, 3)
                                Else
                                If frmtramos.MSFlexGrid1.Rows > 12 And Text1.Text > 12 Then
                                    If MSFlexGrid1.TextMatrix(i, 0) = frmtramos.MSFlexGrid1.TextMatrix(13, 1) And MSFlexGrid1.TextMatrix(i, 1) = frmtramos.MSFlexGrid1.TextMatrix(13, 2) Then
                                    MSFlexGrid1.TextMatrix(i, 2) = frmtramos.MSFlexGrid1.TextMatrix(13, 3)
                                    Else
                                        If frmtramos.MSFlexGrid1.Rows > 13 And Text1.Text > 13 Then
                                        If MSFlexGrid1.TextMatrix(i, 0) = frmtramos.MSFlexGrid1.TextMatrix(14, 1) And MSFlexGrid1.TextMatrix(i, 1) = frmtramos.MSFlexGrid1.TextMatrix(14, 2) Then
                                         MSFlexGrid1.TextMatrix(i, 2) = frmtramos.MSFlexGrid1.TextMatrix(14, 3)
                                        Else
                                         If frmtramos.MSFlexGrid1.Rows > 14 And Text1.Text > 14 Then
                                            If MSFlexGrid1.TextMatrix(i, 0) = frmtramos.MSFlexGrid1.TextMatrix(15, 1) And MSFlexGrid1.TextMatrix(i, 1) = frmtramos.MSFlexGrid1.TextMatrix(15, 2) Then
                                            MSFlexGrid1.TextMatrix(i, 2) = frmtramos.MSFlexGrid1.TextMatrix(15, 3)
                                              Else
                                                If frmtramos.MSFlexGrid1.Rows > 15 And Text1.Text > 15 Then
                                                    If MSFlexGrid1.TextMatrix(i, 0) = frmtramos.MSFlexGrid1.TextMatrix(16, 1) And MSFlexGrid1.TextMatrix(i, 1) = frmtramos.MSFlexGrid1.TextMatrix(16, 2) Then
                                                    MSFlexGrid1.TextMatrix(i, 2) = frmtramos.MSFlexGrid1.TextMatrix(16, 3)
                                                        Else
                                                        If frmtramos.MSFlexGrid1.Rows > 16 And Text1.Text > 16 Then
                                                         If MSFlexGrid1.TextMatrix(i, 0) = frmtramos.MSFlexGrid1.TextMatrix(17, 1) And MSFlexGrid1.TextMatrix(i, 1) = frmtramos.MSFlexGrid1.TextMatrix(17, 2) Then
                                                            MSFlexGrid1.TextMatrix(i, 2) = frmtramos.MSFlexGrid1.TextMatrix(17, 3)
      Else
      MsgBox "Eso no es un tramo", 48, "Atencion"
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If

Next i

aqui adjunto las fotos de los 2 form ( o la parte que me interesa que me ayuden)

form1


form2

6  Programación / Programación Visual Basic / Comparar celdas de msflexgrid diferentes en: 7 Julio 2009, 23:33 pm
Tengo una duda que no me deja avanzar un proyecto...
Resulta que tengo un msflexgrid1 en un  form1  y tengo otro msflexgrid2 en otro form2
-el form1 esta compuesto por un textbox1 un cmd1(boton) y un msflexgrid1
-el form2 esta compuesto por un textbox2 un cmd2(boton) y un msflexgrid2
ya tengo programado el  form1 (el evento click del boton)  para que al introducir un valor en la caja de texto del msflexgrid1 me salgan tantas filas como el valor de ese numero...

el otro form2 tambien lo tengo programado igual en el evento click del boton para que al introducir un valor en la caja de texto del msflexgrid2 me salgan tantas filas como el valor de ese numero...

mi duda es la siguiente:
Como comparo yo las celdas de una columna especifica del msflexgrid1 con las celdas de otra columna especifica del msflexgrid2

Quiero traer valores de las celdas de una columna del msflexgrid1(del form1) a las celdas de una columna del msflexgrid2(en el form2)

Problemas:
 en la caja de texto el form1 yo podria introducir por ejemplo "4" y darle click
entonces en el msflexgrid1 me saldrian 4 filas...(las columnas ya vienen predeterminadas) igual en el form2 en la caja de texto2 yo podria colocar el valor 6 y al darle click al boton me saldrian 6 filas en el msflexgrid2

conclusion: puedo tener el msflexgrid1 con mas columnas q el msflexgrid2 y viceversa.

he tratado esto en el form2:

Código:
 
For i = 1 To Val(Text1.Text) + 1
 If MSFlexGrid1.TextMatrix(i, 1) = frmnodos.MSFlexGrid1.TextMatrix(i, 0) Then
MSFlexGrid1.TextMatrix(i, 3) = frmnodos.MSFlexGrid1.TextMatrix(i, 1)
End If
Next i
pero me da un error... y me imagino que es por los problemas q mencione anteriormente...

Estoy trancado en un proyecto con eso... si hay alguien en este foro que me ayude a resolver este problema lo agradecería enormemente he publicado esto en varios foros y no me han respondido...
Sin embargo en este foro siempre me han dado respuestas satisfactorias..
Muchas gracias de antemano. espero haber planteado lo mejor posible mi problema para que me puedan ayudar...
7  Programación / Programación Visual Basic / Con cual control hago esto? en: 3 Julio 2009, 05:37 am


Con cual control se hace esto y como se programa...
Lo que hace es q cuando yo introduzca un numero y le doy aceptar
el control me muestra tantas celdas como haya metido en el textbox del ovalo de arriba... Como hago eso y como lo programo
Eso lo vi de un programa y quiero usarlo en una aplicacion.
Gracias de antemano
8  Programación / Programación Visual Basic / Crear un informe sin necesidad de base de datos??(Solucionado) en: 2 Julio 2009, 02:55 am
Es posible crear un informe con data report (o crystal reports..) sin depender de una base de datos^?
Se puede hacer enviando los datos desde los controles del formulario?

He buscado bastante y no encuentro algo concreto sore lo que quiero hacer..
Lo que no quiero es tener que crear una base de datos solo para eso... si existe la posibilidad de hacerlo sin bd porfavor que alguien me explique o me sugiera algun post sobre esto..

P.D: Ya lei el post que esta entre los primeros sobre haer informes... pero alli es necesario una base de datos..
9  Programación / Programación Visual Basic / crear un contador a partir de una condicion.??? en: 1 Julio 2009, 23:26 pm
Necesito mostrar en una caja de texto un numero pero con esta condicion
text2 es un valor de la tabla que esta abajo....

Código:
Private Sub cmdcalcularu_Click()
If (txt1.Text = 0) Then
MsgBox "Debe ser un número mayor que cero", 48, "Atencion"
txt1.Text = ""
txt1.SetFocus
 Else
  If (txt1.Text <= 200) Then
  txt2.Text = 1500
   Else
    If (txt1.Text >= 201) And (txt1.Text <= 300) Then
    txt2.Text = 1700
    txt1.SetFocus
     Else
      If (txt1.Text >= 301) And (txt1.Text <= 400) Then
      txt2.Text = 1900
      txt1.SetFocus
       Else
        If (txt1.Text >= 401) And (txt1.Text <= 500) Then
        txt2.Text = 2100
        txt1.SetFocus
         Else
          If (txt1.Text >= 501) And (txt1.Text <= 600) Then
          txt2.Text = 2200
          txt1.SetFocus
           Else
            If (txt1.Text >= 601) And (txt1.Text <= 700) Then
            txt2.Text = 2300
            txt1.SetFocus
             Else
              If (txt1.Text >= 701) And (txt1.Text <= 800) Then
              txt2.Text = 2400
              txt1.SetFocus
               Else
                If (txt1.Text >= 801) And (txt1.Text <= 900) Then
                txt2.Text = 2500
                txt1.SetFocus
                 Else
                  If (txt1.Text >= 901) And (txt1.Text <= 1000) Then
                  txt2.Text = 2600
                  txt1.SetFocus
                   Else
                    If (txt1.Text >= 1001) And (txt1.Text <= 1200) Then
                    txt2.Text = 2800
                    txt1.SetFocus
                     Else
                      If (txt1.Text >= 1201) And (txt1.Text <= 1400) Then
                      txt2.Text = 3000
                      txt1.SetFocus
                       Else
                        If (txt1.Text >= 1401) And (txt1.Text <= 1700) Then
                        txt2.Text = 3400
                        txt1.SetFocus
                         Else
                          If (txt1.Text >= 1701) And (txt1.Text <= 2000) Then
                          txt2.Text = 3800
                          txt1.SetFocus
                           Else
                            If (txt1.Text >= 2001) And (txt1.Text <= 2500) Then
                            txt2.Text = 4500
                            txt1.SetFocus
                             Else
                              If (txt1.Text >= 2501) And (txt1.Text <= 3000) Then
                              txt2.Text = 5000
                              txt1.SetFocus
End Sub

ahora despues de eso necesito que cuando txt1 sea mayor que 3000 al txt2 sea
con la condicion que se me muestra en la siguiente tabla donde txt1 es el area total de la parcela y txt2 la dotacion total de agua correspondient e en 1 dia
aqui esta la imagen de la tabla
http://img189.imageshack.us/i/tablak.jpg/

PD: en el code no he cerrado los if con sus respectivos End If

Páginas: [1]
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines