Visual Basic - ayuda para organizar impresión

Life is soft - evento anual de software empresarial
 
Vista:

ayuda para organizar impresión

Publicado por Germany (53 intervenciones) el 06/10/2006 20:12:03
ok les explico un poco estoy desarrollando mi aplicación para imprimir y controlar recibos de alquileres el problema esta en lo siguiente, dejo varios text vacios para que el usuario ingrese o no los conceptos pero a la hora de imprimir si estos quedan vacios salen impresos para luego continuar con la impresion de otros datos ! como hago para validar uno por uno si los text estan vacios y no dejar esos espacio en blanco! aqui dejo las lineas de codigo para que tengan idea

-----
Private Sub LaVolpeButton9_Click()

Printer.ScaleMode = vbCharacters
Printer.TrackDefault = True

For i = 1 To 8
Printer.Print ""
Next

Printer.Print ""
Printer.FontName = "Arial"
Printer.FontSize = 10
Printer.FontBold = False
Printer.FontUnderline = False

Printer.Print Tab(96); Label1.Caption; Tab(112); Text1.Text
Printer.Print Tab(23); Label2.Caption; Tab(46); Label3.Caption

Printer.Print Tab(23); Label4.Caption; Tab(44); Label46.Caption
Printer.Print Tab(23); Label5.Caption; Tab(96); Label8.Caption
Printer.Print Tab(23); Label6.Caption; Tab(96); Label9.Caption
Printer.Print Tab(23); Label7.Caption; Tab(96); Label10.Caption; Tab(105); Label11.Caption

Printer.Print ""

Printer.Print Tab(23); Label12.Caption
Printer.Print Tab(23); Label13.Caption
Printer.Print Tab(23); Label14.Caption
Printer.Print Tab(23); Label15.Caption
Printer.Print Tab(23); Label16.Caption
Printer.Print Tab(23); Label31.Caption
'''''''''''''''''''''''''

Printer.Print ""

Printer.Print Tab(30); Label17.Caption; Tab(40); Label18.Caption

'''''''''''''''''''
Printer.Print Tab(30); Combo1.Text; Tab(40); Label49.Caption; Tab(65); Label28.Caption; Tab(83); Text2.Text; Tab(110); Label19.Caption; Tab(115); Text12.Text

Printer.Print Tab(30); Combo2.Text; Tab(40); Text3.Text; Tab(110); Label20.Caption; Tab(115); Text13.Text ' A PARTIR DE AQUI EL USUARIO DECIDE SI INGRESA O NO LOS CONCEPTOS

Printer.Print Tab(30); Combo3.Text; Tab(40); Text4.Text; Tab(110); Label21.Caption; Tab(115); Text14.Text

Printer.Print Tab(30); Combo4.Text; Tab(40); Text5.Text; Tab(110); Label22.Caption; Tab(115); Text15.Text

Printer.Print Tab(30); Combo5.Text; Tab(40); Text6.Text; Tab(110); Label23.Caption; Tab(115); Text16.Text

Printer.Print Tab(30); Combo6.Text; Tab(40); Text7.Text; Tab(110); Label24.Caption; Tab(115); Text17.Text

Printer.Print Tab(30); Combo7.Text; Tab(40); Text8.Text; Tab(110); Label25.Caption; Tab(115); Text18.Text

Printer.Print Tab(30); Combo8.Text; Tab(40); Text9.Text; Tab(110); Label26.Caption; Tab(115); Text19.Text

Printer.Print Tab(30); Combo9.Text; Tab(40); Text10.Text; Tab(110); Label27.Caption; Tab(115); Text20.Text ' HASTA AQUI TIENE TEXT LIBRE

'''''''''''''''''''
Printer.Print "" ' TIENE QUE SALTAR A ESTA LINEA CUADO SE TOPE CON UN TEXT VACIO!
If Label41.Visible = True Then
Printer.Print Tab(31); Label41.Caption; Tab(36); Label47.Caption; Tab(43); Label43.Caption; Tab(55); Label14.Caption; Tab(69); Label45.Caption; Tab(110); Label21.Caption; Tab(115); Text14.Text

Printer.Print ""
Printer.Print Tab(40); Label30.Caption; Tab(115); Text11.Text

Else
If Label41.Visible = False Then

Printer.Print ""
Printer.Print Tab(40); Label30.Caption; Tab(115); Text11.Text

Printer.Print ""

Printer.Print Tab(23); Label29.Caption
Printer.Print Tab(23); Label34.Caption; Tab(37); Label32.Caption; Tab(53); Label36.Caption; Tab(65); Label40.Caption
Printer.Print Tab(23); Label35.Caption; Tab(33); Label33.Caption; Tab(54); Label37.Caption; Tab(63); Label48.Caption; Tab(80); Label38.Caption; Tab(95); Label50.Caption

Printer.Print ""
Printer.Print ""
Printer.Print ""
Printer.Print Tab(23); Label39.Caption
Printer.Print Tab(23); Label51.Caption
Printer.Print Tab(23); Label53.Caption

Printer.EndDoc

End If
End If
End If
End If
End Sub
-----

por favor ayuda ojala y alguien me sepa ayuda intente con la sentencia do while pero nanai y el select case la verdad no sabria como help please !!!!
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

RE:ayuda para organizar impresión

Publicado por MariA (38 intervenciones) el 06/10/2006 20:50:44
Olvida los Printer.Print Tab y utiliza la propiedad Printer.CurrentX que marca la posición donde quieres imprimir
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

RE:ayuda para organizar impresión

Publicado por Germany (53 intervenciones) el 06/10/2006 20:55:49
Gracias x la respuesta pero ese no es mi problema en si! solo quiero saber un sentencia que me permita saber cuando cada uno de los text esten vacios para no dejar espacios en blanco y continuar con la impresion de los datos!
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

RE:ayuda para organizar impresión

Publicado por MariA (38 intervenciones) el 06/10/2006 21:05:38
If Not IsNull(Textx) Then ... el campo no está vacio

0

If Textx.Text <> "" Then .. lo mismo de antes
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

RE:ayuda para organizar impresión

Publicado por Germany (53 intervenciones) el 06/10/2006 21:34:56
a ver le puedes hecha el visto bueno o malo a esto por favor

___________________________________________________
Private Sub LaVolpeButton9_Click()

Printer.ScaleMode = vbCharacters
Printer.TrackDefault = True

For i = 1 To 8
Printer.Print ""
Next

Printer.Print ""
Printer.FontName = "Arial"
Printer.FontSize = 10
Printer.FontBold = False
Printer.FontUnderline = False

Printer.Print Tab(96); Label1.Caption; Tab(112); Text1.Text
Printer.Print Tab(23); Label2.Caption; Tab(46); Label3.Caption

Printer.Print Tab(23); Label4.Caption; Tab(44); Label46.Caption
Printer.Print Tab(23); Label5.Caption; Tab(96); Label8.Caption
Printer.Print Tab(23); Label6.Caption; Tab(96); Label9.Caption
Printer.Print Tab(23); Label7.Caption; Tab(96); Label10.Caption; Tab(105); Label11.Caption

Printer.Print ""

Printer.Print Tab(23); Label12.Caption
Printer.Print Tab(23); Label13.Caption
Printer.Print Tab(23); Label14.Caption
Printer.Print Tab(23); Label15.Caption
Printer.Print Tab(23); Label16.Caption
Printer.Print Tab(23); Label31.Caption

Printer.Print ""

Printer.Print Tab(30); Label17.Caption; Tab(40); Label18.Caption

Printer.Print Tab(30); Combo1.Text; Tab(40); Label49.Caption; Tab(65); Label28.Caption; Tab(83); Text2.Text; Tab(110); Label19.Caption; Tab(115); Text12.Text

If Text3.Text = "" Then

Printer.Print ""
If Label41.Visible = True Then
Printer.Print Tab(31); Label41.Caption; Tab(36); Label47.Caption; Tab(43); Label43.Caption; Tab(55); Label14.Caption; Tab(69); Label45.Caption; Tab(110); Label21.Caption; Tab(115); Text14.Text

Printer.Print ""
Printer.Print Tab(40); Label30.Caption; Tab(115); Text11.Text

Else
If Label41.Visible = False Then

Printer.Print ""
Printer.Print Tab(40); Label30.Caption; Tab(115); Text11.Text

Printer.Print ""

Printer.Print Tab(23); Label29.Caption
Printer.Print Tab(23); Label34.Caption; Tab(37); Label32.Caption; Tab(53); Label36.Caption; Tab(65); Label40.Caption
Printer.Print Tab(23); Label35.Caption; Tab(33); Label33.Caption; Tab(54); Label37.Caption; Tab(63); Label48.Caption; Tab(80); Label38.Caption; Tab(95); Label50.Caption

Printer.Print ""
Printer.Print ""
Printer.Print ""
Printer.Print Tab(23); Label39.Caption
Printer.Print Tab(23); Label51.Caption
Printer.Print Tab(23); Label53.Caption

Printer.EndDoc

ElseIf Text3.Text <> "" Then

Printer.Print Tab(30); Combo2.Text; Tab(40); Text3.Text; Tab(110); Label20.Caption; Tab(115); Text13.Text

End If

If Text4.Text = "" Then

Printer.Print ""
If Label41.Visible = True Then
Printer.Print Tab(31); Label41.Caption; Tab(36); Label47.Caption; Tab(43); Label43.Caption; Tab(55); Label14.Caption; Tab(69); Label45.Caption; Tab(110); Label21.Caption; Tab(115); Text14.Text

Printer.Print ""
Printer.Print Tab(40); Label30.Caption; Tab(115); Text11.Text

Else
If Label41.Visible = False Then

Printer.Print ""
Printer.Print Tab(40); Label30.Caption; Tab(115); Text11.Text

Printer.Print ""

Printer.Print Tab(23); Label29.Caption
Printer.Print Tab(23); Label34.Caption; Tab(37); Label32.Caption; Tab(53); Label36.Caption; Tab(65); Label40.Caption
Printer.Print Tab(23); Label35.Caption; Tab(33); Label33.Caption; Tab(54); Label37.Caption; Tab(63); Label48.Caption; Tab(80); Label38.Caption; Tab(95); Label50.Caption

Printer.Print ""
Printer.Print ""
Printer.Print ""
Printer.Print Tab(23); Label39.Caption
Printer.Print Tab(23); Label51.Caption
Printer.Print Tab(23); Label53.Caption

Printer.EndDoc

ElseIf Text4.Text <> "" Then

Printer.Print Tab(30); Combo3.Text; Tab(40); Text4.Text; Tab(110); Label21.Caption; Tab(115); Text14.Text
End If

If Text5.Text = "" Then

Printer.Print ""
If Label41.Visible = True Then
Printer.Print Tab(31); Label41.Caption; Tab(36); Label47.Caption; Tab(43); Label43.Caption; Tab(55); Label14.Caption; Tab(69); Label45.Caption; Tab(110); Label21.Caption; Tab(115); Text14.Text

Printer.Print ""
Printer.Print Tab(40); Label30.Caption; Tab(115); Text11.Text

Else
If Label41.Visible = False Then

Printer.Print ""
Printer.Print Tab(40); Label30.Caption; Tab(115); Text11.Text

Printer.Print ""

Printer.Print Tab(23); Label29.Caption
Printer.Print Tab(23); Label34.Caption; Tab(37); Label32.Caption; Tab(53); Label36.Caption; Tab(65); Label40.Caption
Printer.Print Tab(23); Label35.Caption; Tab(33); Label33.Caption; Tab(54); Label37.Caption; Tab(63); Label48.Caption; Tab(80); Label38.Caption; Tab(95); Label50.Caption

Printer.Print ""
Printer.Print ""
Printer.Print ""
Printer.Print Tab(23); Label39.Caption
Printer.Print Tab(23); Label51.Caption
Printer.Print Tab(23); Label53.Caption

Printer.EndDoc

ElseIf Text5.Text <> "" Then

Printer.Print Tab(30); Combo4.Text; Tab(40); Text5.Text; Tab(110); Label22.Caption; Tab(115); Text15.Text

End If
End If
End If
End If

End Sub

quisiera saber como hago para no repetir varias veces estas linea de codigo

Printer.Print ""
If Label41.Visible = True Then
Printer.Print Tab(31); Label41.Caption; Tab(36); Label47.Caption; Tab(43); Label43.Caption; Tab(55); Label14.Caption; Tab(69); Label45.Caption; Tab(110); Label21.Caption; Tab(115); Text14.Text

Printer.Print ""
Printer.Print Tab(40); Label30.Caption; Tab(115); Text11.Text

Else
If Label41.Visible = False Then

Printer.Print ""
Printer.Print Tab(40); Label30.Caption; Tab(115); Text11.Text

Printer.Print ""

Printer.Print Tab(23); Label29.Caption
Printer.Print Tab(23); Label34.Caption; Tab(37); Label32.Caption; Tab(53); Label36.Caption; Tab(65); Label40.Caption
Printer.Print Tab(23); Label35.Caption; Tab(33); Label33.Caption; Tab(54); Label37.Caption; Tab(63); Label48.Caption; Tab(80); Label38.Caption; Tab(95); Label50.Caption

Printer.Print ""
Printer.Print ""
Printer.Print ""
Printer.Print Tab(23); Label39.Caption
Printer.Print Tab(23); Label51.Caption
Printer.Print Tab(23); Label53.Caption

Printer.EndDoc

cuando el text este vacio !
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

RE:ayuda para organizar impresión

Publicado por Angel (8 intervenciones) el 06/10/2006 22:45:43
Buenas, creo que te estas complicando algo, no se si te puede servir pero yo lo intentaria de otro modo, porque no creas un vector o array de texto(ej.: Dim vector(14) as string, si tienes 15 Text), después vas recorriendo los Text(para esto hay varias maneras) y tal como los recorres vas llenando el vector con los valores, en cada caso que tengas un text = "" le añades el codigo de tecla de retroceso( Chr(8) ), y por fin en lugar de printer.print Text6 será printer.print vector(7)
Espero que te sirva
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

RE:ayuda para organizar impresión

Publicado por MariA (38 intervenciones) el 06/10/2006 22:47:27
Me parece que no leiste mis respuestas anteriores.
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

RE:ayuda para organizar impresión

Publicado por Angel (8 intervenciones) el 06/10/2006 23:06:48
Pues no, perdona me he lanzado a responder.........

Pd: ayer me ayudaste con el formato fecha en un mshflexgrid cosa que te agradezco, pero no me acabó de funcionar, si me puedes ayudar te lo agradeceria todavia mássss, no se si has leido mi respuesta, sino te explico: la solución que me diste funciona pero solo en aquellas fechas en las que el día es mayor que 12

Graciasss
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

RE:ayuda para organizar impresión

Publicado por MariA (38 intervenciones) el 06/10/2006 23:24:17
Hola Angel.
La respuesta anterior no iba para tí sino para Germany

De todas formas no me acuerdo de la respuesta del mshflexgrid (aquí los mensajes desaparecen rapidamente) pero si lo puedes volver a exponer intentaré ayudar en lo que pueda.
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

RE:ayuda para organizar impresión

Publicado por Germany (53 intervenciones) el 09/10/2006 15:23:26
Angel me puedes pasar un ejemplo es que soy nueva y todavia no se como trabajar con vectores gracias!!

Maria si es lo de los text vacios si la lei! aunque ya lo sabia muchas gracias pro la ayuda!
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

RE:ayuda para organizar impresión

Publicado por Germany (53 intervenciones) el 09/10/2006 15:36:45
Maria te puedo agregar al msn para explicarte mejor es que realmente me urge esto! gracias
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar