Visual Basic - Imprimir un DataGrid

Life is soft - evento anual de software empresarial
 
Vista:

Imprimir un DataGrid

Publicado por David (12 intervenciones) el 31/10/2004 12:36:17
Tengo un DataGrid y quiero imprimirlo (con el objeto printer). Necesito que por la impresora me salga la tabla completa: datos y rejilla. ¿Alguien puede ayudarme?. GRACIAS.
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:Imprimir un DataGrid

Publicado por Christian (208 intervenciones) el 01/11/2004 22:02:11
Hola,

Usa un formulario de Cristal report, no solo te va a simplificar mas las cosas sino tambien que te va a separar las hojas mucho mejor.

Saludos.
Christian.
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:Imprimir un DataGrid

Publicado por Ismael Garzia (1 intervención) el 21/07/2005 22:02:23
no hay una forma de hacerlo directo, si usar cristal report, es decir kon el objeto printer?
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
sin imagen de perfil

RE:Imprimir un DataGrid

Publicado por Daniel (61 intervenciones) el 22/07/2005 16:19:00
Si, agregale un boton al datagrid, y a ese boton le pones , por ejemplo:

DataGrid1.PrintForm

No se si es eso lo que necesitabas.
Suerte.
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:Imprimir un DataGrid

Publicado por CUMBI (1 intervención) el 23/07/2006 21:08:22
Hola
acabo de ver este foro y tengo problemas para imprimir un datagrid.
Me ha parecido interesante lo del método PrintForm.

Como se consigue que tu datagrid tenga ese método o procedimiento

Un saludo

Cumbi
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

Aqui tienes tu Solucion

Publicado por Luis Felipe (1 intervención) el 02/05/2007 04:18:35
Aqui te mando el codigo fuente con que solo teclees las coordenadas para ajustar su impresion espero te sirva, me gustaria que me mandaras un correo al final si te llega a servir

Si algun dia necesitas servicios que te hagan un programa para algo tenemos costos accesibles, saludos Amigo:

'AQUI SE MUESTRA EL CODIGO PARA PODER MANDAR A IMPRIMIR ALGUN REGISTRO
'DENTRO DE UN DATAGRID VISUALIZANDO SOLO ALGUNOS DE LOS CAMPOS DE LA
'BASE DE DATOS

Me imagino que sabras que por ejemplo adodc1.recordset("nombre") <- es el nombre del campo. solo necesitas los siguientes controles

1.- Datagrid
1.- ADO
1.- Commandbutton

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
Dim contador As Integer
Dim contadoruno As Integer
 
Private Sub Command1_Click()
Adodc1.Recordset.MoveFirst
contado = 15000
 For i = 1 To Adodc1.Recordset.RecordCount
  '--------------------------------------->"IMPRIME EL CAMPO [NOMBRE]"
  contador = contador + 290
  Printer.CurrentX = 1000
  Printer.CurrentY = 1500 + contador
  Printer.Print Adodc1.Recordset("nombre")
  '--------------------------------------->"IMPRIME EL CAMPO [CANTIDAD]"
  contador = contador + 0
  Printer.CurrentX = 500
  Printer.CurrentY = 1500 + contador
  Printer.Print Adodc1.Recordset("cantidad")
  '--------------------------------------->"IMPRIME EL CAMPO [TOTAL]"
  contador = contador + 0
  Printer.CurrentX = 10900
  Printer.CurrentY = 1500 + contador
  Printer.Print Adodc1.Recordset("total")
  '--------------------------------------->"IMPRIME EL CAMPO [SUBTOTAL]"
  contador = contador + 0
  Printer.CurrentX = 10000
  Printer.CurrentY = 1500 + contador
  Printer.Print Adodc1.Recordset("subtotal")
  '\\\\\\\\\\\\\\\\\\\\\\ PASA AL SIGUIENTE
  Adodc1.Recordset.MoveNext
 Next
  '--------------------------------------->"IMPRIME LA ETIQUETA [CANTIDAD]"
  Printer.CurrentX = 200
  Printer.CurrentY = 1200
  Printer.Print "CANTIDAD"
  '--------------------------------------->"IMPRIME LA ETIQUETA [NOMBRE DEL PRODUCTO]"
  Printer.CurrentX = 4000
  Printer.CurrentY = 1200
  Printer.Print "NOMBRE DEL PRODUCTO"
  '--------------------------------------->"IMPRIME LA ETIQUETA [SUBTOTAL]"
  Printer.CurrentX = 9872
  Printer.CurrentY = 1200
  Printer.Print "SUBTOTAL"
  '--------------------------------------->"IMPRIME LA ETIQUETA [TOTAL]"
  Printer.CurrentX = 10930
  Printer.CurrentY = 1200
  Printer.Print "TOTAL"
  '--------------------------------------->"IMPRIME LA LINEA"
  Printer.CurrentX = 150
  Printer.CurrentY = 1500
  Printer.Print "__________________________________________________________________________________________________________________________________"
End Sub
 
Private Sub Form_Load()
 MsgBox "Tambien los Tabasqueños nos destacamos: Codigo Elaborado por Luis Felipe Perez Gaspar, cualquier cosa mandenme un mail al nene_luisfelipe@hotmail.com", vbInformation, "Tabasqueños Adelante"
End Sub
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
1
Comentar

ayudamee

Publicado por anabela (1 intervención) el 22/07/2011 18:23:23
hoLaa! fijate que yo tengo que hacer un programa relacionado con cemaco hecho en visual! no se cuanto me cobrarias por hacerlo.!
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

Aqui tienes tu Solucion

Publicado por Mariany (2 intervenciones) el 07/12/2011 15:17:01
hola esta muy interesante el codigo y realmente util para l oque hago, solo tengo una duda, como modifico la orientacion, para que me salga la hoja con los registros bien alineados?
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

Muchas Gracias

Publicado por Victor (1 intervención) el 01/03/2016 01:24:58
Muchas Gracias amigo, me pase un aproximado de dos horas buscándole la lógica pero finalmente le conseguí, 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

Muchas Gracias

Publicado por EBER BEDOYA (1 intervención) el 28/04/2021 18:56:37
ESE CODIGO IMPRIME TODO, PERO TENGO QUE CERRAR TODO EL SISTEMA PARA QUE IMPRIMA.....SINO CIERRO EL SISTEMA QUEDA EN ESPERA EN LA IMPRESORA....QUE PUEDO HACER..
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