|
73
|
Programación / Programación Visual Basic / imprimir list1
|
en: 3 Octubre 2020, 16:32 pm
|
Hola soy corlo tengo una duda para imprimir list1 el codigo que tengo hasta ahora es el siguiente
Private Sub Command7_Click() ' Imprimir Dim total As String Dim total1 As String Dim total2 As String Dim i As Integer
Dim factura As Integer
ReDim lbtab(1 To 4) As Long
lbtab(1) = 31 lbtab(2) = 141 lbtab(3) = 278 lbtab(4) = 478 SendMessageArray List1.hwnd, LB_SETTABSTOPS, 4, lbtab(1)
total = Label5.Caption total1 = Label6.Caption total2 = Label7.Caption
Printer.FontSize = 18
Printer.CurrentX = 3100 Printer.CurrentY = 0 Printer.Print "Factura Nº:" Printer.CurrentX = 5000 Printer.CurrentY = 0 Printer.Print Txtnum.Text
Printer.CurrentX = 1000 Printer.CurrentY = 3000 Printer.Print "Cantidad" Printer.CurrentX = 3500 Printer.CurrentY = 3000 Printer.Print "Producto" Printer.CurrentX = 7350 Printer.CurrentY = 3000 Printer.Print "Precio" Printer.CurrentX = 9900 Printer.CurrentY = 3000 Printer.Print "Subtotal"
For i = 0 To List1.ListCount - 1 List1.ListIndex = i
Printer.Print List1.List(i) Next
List1.Clear
Printer.CurrentX = 8400 Printer.CurrentY = 10000 Printer.Print "Subtotal:" Printer.CurrentX = 9300 Printer.CurrentY = 10500 Printer.Print "iva:" Printer.CurrentX = 9000 Printer.CurrentY = 11000 Printer.Print "Total:"
Printer.CurrentX = 10000 Printer.CurrentY = 10000 Printer.Print total Printer.CurrentX = 10000 Printer.CurrentY = 10500 Printer.Print total1 Printer.CurrentX = 10000 Printer.CurrentY = 11000 Printer.Print total2
Printer.Print
Printer.EndDoc
End Sub
la impresion lo hace bien como puedo hacer las separaciones del list1 a la hora de imprimir las columnas el list1 tiene 4 columnas ReDim lbtab(1 To 4) As Long lbtab(1) = 31 lbtab(2) = 141 lbtab(3) = 278 lbtab(4) = 478 SendMessageArray List1.hwnd, LB_SETTABSTOPS, 4, lbtab(1)
|
|
|
75
|
Programación / Programación Visual Basic / imagenes aleatorias seguidas
|
en: 7 Septiembre 2020, 23:22 pm
|
Hola soy corlo estoy haciendo un pequeño codigo de imagenes aleatorias, que apretando un command1 me va generando una imagen aleatoria, funciona perfectamente ahora lo que quiero es que con otro boton command2 me haga todas las imagenes aleatorias seguidas mediante un intervalo de tiempo. en el formulario hay : filelistbox=archivos image1 el codigo es el siguiente: Private Sub Command1_Click() Dim aleatorio As Integer aleatorio = Int(((archivos.ListCount - 1) * -1) * Rnd + archivos.ListCount - 1) Image1.Picture = LoadPicture(App.Path + "\imagenes\" + archivos.List(aleatorio)) End Sub
Private Sub Form_Load() archivos.Path = App.Path + "\imagenes\" End Sub
gracias
|
|
|
76
|
Programación / Programación Visual Basic / Re: leer indice del archivo txt
|
en: 19 Junio 2020, 12:50 pm
|
hola nebire
ya lo se que se puede mejorar la estructua del programa , pero por lo que necesito yo de momento ya vale , pero si lo quieres mejorar , lo puedes mejorar.
trabajo con archivos secuenciales por poca informacion
gracias por responder
|
|
|
77
|
Programación / Programación Visual Basic / Re: leer indice del archivo txt
|
en: 18 Junio 2020, 23:20 pm
|
hola nebire gracias por contestar al final lo he conseguido dejo el codigo por si alguien le interesa
Private Sub Command1_Click() Open App.Path & "\Base1.txt" For Input As #1 Do While Not EOF(1) Input #1, identificacion, azar, azar1, azar2, azar3, azar4 Loop Close #1
Text1 = identificacion + 1 identificacion = identificacion + 1 Text2 = Empty Text3 = Empty Text4 = Empty Text5 = Empty Text6 = Empty End Sub
Private Sub Command2_Click() Open App.Path & "\Base1.txt" For Append As #1 Write #1, Text1, Text2, Text3, Text4, Text5, Text6 Close #1
End Sub
Private Sub Command3_Click() Open App.Path & "\Base1.txt" For Input As #1 Do While Not EOF(1) Input #1, identificacion, azar, azar1, azar2, azar3, azar4 If Text1 = identificacion Then
Text2 = azar Text3 = azar1 Text4 = azar2 Text5 = azar3 Text6 = azar4 End If Loop Close #1 End Sub
Private Sub Command4_Click() End End Sub
Private Sub Command5_Click()
Randomize azar = Int(Rnd * 45) + 1 Text2 = azar azar1 = Int(Rnd * 45) + 1 Text3 = azar1 azar2 = Int(Rnd * 45) + 1 Text4 = azar2 azar3 = Int(Rnd * 45) + 1 Text5 = azar3 azar4 = Int(Rnd * 45) + 1 Text6 = azar4 End Sub
Private Sub Form_Load() If identificacion = 0 Then Open App.Path & "\Base1.txt" For Append As #1 Close #1 End If If identificacion = 0 Then identificacion = 0 Open App.Path & "\Base1.txt" For Input As #1 Do While Not EOF(1) Input #1, identificacion, azar, azar1, azar2, azar3, azar4 Loop Text1 = identificacion + 1 Close #1
End Sub
gracias
|
|
|
79
|
Programación / Programación Visual Basic / Re: leer indice del archivo txt
|
en: 17 Junio 2020, 22:27 pm
|
hola
gracias MCKSys Argentina por contestar pero lo que yo necesito es trabajar con archivos secuenciales
Error '62' en tiempo de ejecucion: la entrada de datos se ha sobrepasado el final del archivo en la linea: Input #1, azar, azar1, azar2, azar3, azar4
y lo que yo quiero es leer la variable contador al final del archivo del formload
gracias
|
|
|
80
|
Programación / Programación Visual Basic / leer indice del archivo txt
|
en: 17 Junio 2020, 12:49 pm
|
Hola soy corlo estoy haciendo un codigo para leer el final del archivo del indice o sea text6.text text6.text=contador text1.text=azar text2.text=azar1 text3.text=azar2 text3.text=azar3 text4.text=azar4 a la hora de grabar la informacion me lo hace bien, pero cuando cierro el programa y lo ejecuto otra vez me dice el siguiente error en el form load Error '62' en tiempo de ejecucion: la entrada de datos se ha sobrepasado el final del archivo en la linea: Input #1, azar, azar1, azar2, azar3, azar4 y lo que yo quiero es leer la variable contador al final del archivo
Dim contador As Integer Dim azar As Integer Dim azar1 As Integer Dim azar2 As Integer Dim azar3 As Integer Dim azar4 As Integer
Private Sub Command1_Click() 'Nuevo Text6.Text = contador + 1 contador = contador + 1 Text1.Text = "" Text2.Text = "" Text3.Text = "" Text4.Text = "" Text5.Text = ""
End Sub
Private Sub Command2_Click()
'Guardar
Open App.Path & "\azar" & ".txt" For Append As #1 Print #1, Text6.Text & vbCrLf Print #1, Text1.Text, Text2.Text, Text3.Text, Text4.Text, Text5.Text & vbCrLf Close #1
End Sub
Private Sub Command4_Click() End End Sub
Private Sub Command5_Click() ' Calcular
Randomize azar = Int(Rnd * 45) + 1 Text1.Text = azar azar1 = Int(Rnd * 45) + 1 Text2.Text = azar1 azar2 = Int(Rnd * 45) + 1 Text3.Text = azar2 azar3 = Int(Rnd * 45) + 1 Text4.Text = azar3 azar4 = Int(Rnd * 45) + 1 Text5.Text = azar4 End Sub
Private Sub Form_Load() If contador = 0 Then Open App.Path & "\azar" & ".txt" For Append As #1 Close #1 End If If contador = 0 Then contador = 1 Open App.Path & "\azar" & ".txt" For Input As #1 While Not EOF(1) Input #1, contador Input #1, azar, azar1, azar2, azar3, azar4
en el segunda lectura me pone el siguiente error: Error '62' en tiempo de ejecucion: la entrada de datos se ha sobrepasado el final del archivo
Wend Close #1 Text6.Text = contador End Sub
Gracias
|
|
|
|
|
|
|