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

 

 


Tema destacado:


  Mostrar Mensajes
Páginas: 1 2 3 4 [5]
41  Programación / Programación Visual Basic / Re: Poner un scrollbar horizontal a listbox en: 26 Agosto 2005, 14:25 pm
La verdad tampoco encuentro como hacerlo con un Listbox.

En cambio te doy una alternativa, con un Textbox, propiedades MultiLine = True y ScrollBars = 3 - Both

Código:
Private Sub Command1_Click()
    AddItem "adncnlsfjeportfdfgmgjktyuktyklskaewhuihkyyumhrhiwerhw_Linea _larguísimaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa!!!!!!!!!!"
End Sub

Private Sub AddItem(elemento As String)
    Static contador As Integer
    contador = contador + 1 '<--< Opcional
    'Código realmente importante
    Text1 = Text1 + "Item" + CStr(contador) + " - " + elemento + vbCrLf
    Text1.SelStart = Len(Text1)
    Text1.SetFocus
End Sub

De esta forma pienso que podrás lograr el efecto deseado.
Y naturalmente también crear un OCX, a partir del Textbox, un nuevo Listbox que se adapte a tus necesidades.

Chau
42  Programación / Programación Visual Basic / Re: Seleccionar *.txt e importar la info a un *.xls en: 24 Agosto 2005, 19:40 pm
Puedes usar controles Activex en todas las aplicaciones del Office.
Vas al menu View (Ver) -> Toolbars (barra de herramientas) -> Control Toolbox (cuadro de herramientas).



Añades el Dialog control en Activex avanzados y ya tienes tu interfaz de windows.

Te pongo el ejemplo con un CommandButton, luego lo adaptas a ti

Código:
Private Sub CommandButton1_Click()
    Dim file As String
    CommonDialog1.ShowOpen
    file = CommonDialog1.Filename
    MsgBox file '<--< Ejemplo para ver el path
End Sub


Saludos.
43  Programación / Programación Visual Basic / Re: Gif en form en: 24 Agosto 2005, 14:26 pm
Siguiendo este hilo, no he querido dejar de compartir otro código mucho más autónomo, con el cual sé que alguno que otro se animará ya a crear su propio OCX

Se usa un control Image (con Index = 0 - previamente establecido para crear un array) y un Timer.

Código:
Dim RepeatTimes&
Dim RepeatCount&

Private Sub Form_Load()
    LoadAniGif App.Path & "\Ejemplo.Gif", Image1 'El Gif a reproducir en el mismo directorio del programa
End Sub

Private Sub LoadAniGif(xFile As String, xImgArray)
       
    Dim F1, F2
    Dim Image1s() As String
    Dim imgHeader As String
    Static buf$, picbuf$
    Dim fileHeader As String
    Dim imgCount
    Dim i&, j&, xOff&, yOff&, TimeWait&
    Dim GifEnd
    GifEnd = Chr(0) & "!ù"
   
    Timer1.Enabled = False
    For i = 1 To xImgArray.Count - 1
        Unload xImgArray(i)
    Next i
   
    F1 = FreeFile
On Error GoTo badFile:
    Open xFile For Binary Access Read As F1
        buf = String(LOF(F1), Chr(0))
        Get #F1, , buf
    Close F1
   
    i = 1
    imgCount = 0
   
    j = (InStr(1, buf, GifEnd) + Len(GifEnd)) - 2
    fileHeader = Left(buf, j)
    i = j + 2
   
    RepeatTimes& = Asc(Mid(fileHeader, 126, 1)) + (Asc(Mid(fileHeader, 127, 1)) * 256)
   
    Do
        imgCount = imgCount + 1
        j = InStr(i, buf, GifEnd) + Len(GifEnd)
        If j > Len(GifEnd) Then
            F2 = FreeFile
            Open "tmp.gif" For Binary As F2
                picbuf = String(Len(fileHeader) + j - i, Chr(0))
                picbuf = fileHeader & Mid(buf, i - 1, j - i)
                Put #F2, 1, picbuf
                imgHeader = Left(Mid(buf, i - 1, j - i), 16)
            Close F2
           
            TimeWait = ((Asc(Mid(imgHeader, 4, 1))) + (Asc(Mid(imgHeader, 5, 1)) * 256)) * 10
            If imgCount > 1 Then
                xOff = Asc(Mid(imgHeader, 9, 1)) + (Asc(Mid(imgHeader, 10, 1)) * 256)
                yOff = Asc(Mid(imgHeader, 11, 1)) + (Asc(Mid(imgHeader, 12, 1)) * 2561)
                Load xImgArray(imgCount - 1)
                xImgArray(imgCount - 1).ZOrder 0
                xImgArray(imgCount - 1).Left = xImgArray(0).Left + (xOff * 15)
                xImgArray(imgCount - 1).Top = xImgArray(0).Top + (yOff * 15)
            End If
            xImgArray(imgCount - 1).Tag = TimeWait
            xImgArray(imgCount - 1).Picture = LoadPicture("tmp.gif")
            Kill ("tmp.gif")
           
            i = j
        End If
    Loop Until j = Len(GifEnd)
   
    If i < Len(buf) Then
        F2 = FreeFile
        Open "tmp.gif" For Binary As F2
            picbuf = String(Len(fileHeader) + Len(buf) - i, Chr(0))
            picbuf = fileHeader & Mid(buf, i - 1, Len(buf) - i)
            Put #F2, 1, picbuf
            imgHeader = Left(Mid(buf, i - 1, Len(buf) - i), 16)
        Close F2

        TimeWait = ((Asc(Mid(imgHeader, 4, 1))) + (Asc(Mid(imgHeader, 5, 1)) * 256)) * 10
        If imgCount > 1 Then
            xOff = Asc(Mid(imgHeader, 9, 1)) + (Asc(Mid(imgHeader, 10, 1)) * 256)
            yOff = Asc(Mid(imgHeader, 11, 1)) + (Asc(Mid(imgHeader, 12, 1)) * 2561)
            Load xImgArray(imgCount - 1)
            xImgArray(imgCount - 1).ZOrder 0
            xImgArray(imgCount - 1).Left = xImgArray(0).Left + (xOff * 15)
            xImgArray(imgCount - 1).Top = xImgArray(0).Top + (yOff * 15)
        End If
        xImgArray(imgCount - 1).Tag = TimeWait
        xImgArray(imgCount - 1).Picture = LoadPicture("tmp.gif")
        Kill ("tmp.gif")
    End If
   
On Error GoTo badTime
    Timer1.Interval = CInt(xImgArray(0).Tag)
badTime:
    Timer1.Enabled = True
Exit Sub
badFile:
    MsgBox "File not found.", vbExclamation, "File Error"

End Sub

Private Sub Timer1_Timer()

    For i = 0 To Image1.Count
        If i = Image1.Count Then
            If RepeatTimes > 0 Then
                RepeatCount = RepeatCount + 1
                If RepeatCount > RepeatTimes Then
                    Timer1.Enabled = False
                    Exit Sub
                End If
            End If
            For j = 1 To Image1.Count - 1
                Image1(j).Visible = False
            Next j
On Error GoTo badTime
            Timer1.Interval = CLng(Image1(0).Tag)
badTime:
            Exit For
        End If
        If Image1(i).Visible = False Then
            Timer1.Interval = CLng(Image1(i).Tag)
On Error GoTo badTime2
            Image1(i).Visible = True
badTime2:
            Exit For
        End If
    Next i

End Sub


Enjoy
44  Programación / Programación Visual Basic / Re: VB No multiplica, es una verguenza en: 22 Agosto 2005, 23:30 pm
Citar
Bueno, alguien me puede explicar si yo hago mal algo, o porque pasa esto..?

Te respondo con la misma Ayuda de Visual Basic

Citar
Un desbordamiento ocurre cuanto intenta realizar una asignación que supera las limitaciones del destino de la asignación. Las causas y posibles soluciones de este error son las siguientes:

El resultado de una asignación, de un cálculo o de una conversión de tipos de datos es demasiado grande para que pueda ser representado dentro del intervalo asignado a este tipo de variable.
Asigne el valor a una variable de un tipo que pueda alijar un intervalo de valores más amplio.

Una asignación a una propiedad excede el valor máximo que ésta puede aceptar.
Asegúrese de que la asignación se adapta al intervalo de la propiedad para la que se realiza.

Intenta utilizar un número en un cálculo y dicho número se fuerza en un entero, pero el resultado es mayor que un número entero. Por ejemplo:
    Dim x As Long
    x = 2000 * 365   ' Error: Overflow
Para solventar esta situación, escriba el número de la siguiente forma:

    Dim x As Long
    x = CLng(2000) * 365

45  Programación / Programación Visual Basic / Re: Gif en form en: 22 Agosto 2005, 04:51 am
En Image1(1) ...hasta... Imagen1(N) para cada cuadro del Gif

Código:
Private Sub Timer1_Timer()
    Static i
    i = i + 1: If i = Image1.Count Then i = 1
    Image1(0).Picture = Image1(i).Picture
End Sub

También con el ImageList, puedes hacerlo parecido usando el Index de los Items;
la idea NYlOn - te recomiendo que uses matrices de controles y bucles, te ahorrarás cantidad de código.

Chau
46  Programación / Programación Visual Basic / Re: ProgressBar con un PictureBox (aportando code para todos). en: 21 Agosto 2005, 22:19 pm
Citar
este otro, asi si llega a 100 no sigue sumando ^^

jaja - tienes razón se me fue ese detalle..
ahora ya tienes la idea de como se calcula un progreso. por eso te puse la funcion del porciento ;)

Chau
47  Programación / Programación Visual Basic / Re: Problema con sockets Cliente - Servidor ( IP ) en: 21 Agosto 2005, 16:19 pm
JAJA NYlOn - bien por ti! - pero ese tipo nunca da las gracias..
No ves que es de 'élite;)
48  Programación / Programación Visual Basic / Re: como NO poner iconos en un form? en: 21 Agosto 2005, 16:05 pm
Citar
la respuesta de GoodBye es valida
no hace falta tener un icono vacio

Siempre y cuando
Citar
la propiedad BorderStyle = 3 - Fixed Dialog
sino
Citar
igual deja el predeterminado del sistema

Chau
49  Programación / Programación Visual Basic / Re: ProgressBar con un PictureBox (aportando code para todos). en: 21 Agosto 2005, 09:41 am
Olvidate del timer..

Código:
Const T = 100 'En base a un Total

Private Function Porciento(Cantidad As Long, Total As Long) As Integer
    Porciento = Cantidad / Total * 100
End Function

Private Sub Command1_Click()
    Static C As Long
    C = C + 1
    ProgBar Picture1, CLng(Porciento(C, T)), vbWhite, vbBlue, vbBlack, True, 0
End Sub
50  Programación / Programación Visual Basic / Re: Error subconsulta MySQL! en: 20 Agosto 2005, 10:48 am
Este funciona en SQL Server..
de cualquier manera tratamos con  8) Mr. Structured Query Language

Suponiendo que esta sea tu base


Código:
SELECT     dbo.movies.title, dbo.actores.descripcion
FROM         dbo.actores INNER JOIN
                      dbo.reparto ON dbo.actores.id_actor = dbo.reparto.id_actor INNER JOIN
                      dbo.movies ON dbo.reparto.id_movie = dbo.movies.id_movie
WHERE     (dbo.actores.descripcion LIKE 'smith')

.. espero haberte sido util  ;D



Para los que quieran saber a grandes rasgos las diferencias entre Access, SQL Server, MySQL y PostgreSQL visiten el siguiente link:

http://www.arsys.es/soporte/programacion/comparativa.htm


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