|
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 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 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 OCXSe usa un control Image (con Index = 0 - previamente establecido para crear un array) y un Timer.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
|
Bueno, alguien me puede explicar si yo hago mal algo, o porque pasa esto..? Te respondo con la misma Ayuda de Visual Basic 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 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
|
|
|
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 baseSELECT 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 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.htmChau
|
|
|
|
|
|
|