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

 

 


Tema destacado: Sigue las noticias más importantes de seguridad informática en el Twitter! de elhacker.NET


  Mostrar Mensajes
Páginas: 1 2 3 4 5 [6] 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
51  Programación / .NET (C#, VB.NET, ASP) / Re: Imprimir report rdlc vs 2010 vb.net , Consulta en: 14 Octubre 2015, 01:15 am
Me rindo, sinceramente no se como pasarle el documento YA CREADO

El control tiene todos los datos necesarios desde su atributos, como carajos los obtengo para pasarselo al P....  reporte!?

Código
  1.  
  2. Me.ReportViewer1.Clear()
  3.  
  4.            Dim FACT As New ReportParameter("FACT", Convert.ToInt32(lbl_Consecutivo.Text))
  5.            Dim Subtotal_Descuento As String = String.Empty
  6.  
  7.  
  8.            Subtotal_Descuento = Convert.ToDouble(lbl_Subtotal.Text - lblDescuento.Text)
  9.  
  10.            Dim Subtotal_con_Descuento As New ReportParameter("Subtotal_Con_Descuento", Subtotal_Descuento)
  11.  
  12.           'Acá lleno los table adapter para el CONTROL del report viewer, donde si se ve!!
  13.  
  14.            Me.tbl_HEADERTableAdapter.Fill(Me.FACTURACIONDataSet1.tbl_HEADER)
  15.            Me.tbl_DETAILTableAdapter.Fill(Me.FACTURACIONDataSet.tbl_DETAIL)
  16.  
  17.  
  18.            Me.ReportViewer1.LocalReport.SetParameters(New ReportParameter() {FACT})
  19.            Me.ReportViewer1.LocalReport.SetParameters(New ReportParameter() {Subtotal_con_Descuento})
  20.  
  21.            Me.ReportViewer1.RefreshReport()
  22.  
  23.            imprimir_reporte(Me.ReportViewer1.LocalReport(), 3.92884, 8.9933)
  24.  
  25.  


Acá es donde trato de imprimir

Código
  1.  
  2. ' Export the given report as an EMF (Enhanced Metafile) file.
  3.    Private Sub Exportar(ByVal report As LocalReport)
  4.  
  5.        Dim w As Integer = 0
  6.        Dim h As Integer = 0
  7.  
  8.  
  9.        If printdoc.DefaultPageSettings.Landscape = True Then
  10.            w = printdoc.DefaultPageSettings.PaperSize.Height
  11.            h = printdoc.DefaultPageSettings.PaperSize.Width
  12.        Else
  13.            w = printdoc.DefaultPageSettings.PaperSize.Width
  14.            h = printdoc.DefaultPageSettings.PaperSize.Height
  15.        End If
  16.  
  17.  
  18.        Dim deviceInfo As String = "<DeviceInfo>" & _
  19.            "<OutputFormat>EMF</OutputFormat>" & _
  20.            "<PageWidth>" & w / 100 & "in</PageWidth>" & _
  21.            "<PageHeight>" & h / 100 & "in</PageHeight>" & _
  22.            "<MarginTop>0.0in</MarginTop>" & _
  23.            "<MarginLeft>0.0in</MarginLeft>" & _
  24.            "<MarginRight>0.0in</MarginRight>" & _
  25.            "<MarginBottom>0.0in</MarginBottom>" & _
  26.            "</DeviceInfo>"
  27.  
  28.  
  29.        m_streams = New List(Of Stream)()
  30.        report.Render("Image", deviceInfo, AddressOf CreateStream, warnings)
  31.  
  32.        For Each stream As Stream In m_streams
  33.            stream.Position = 0
  34.        Next
  35.  
  36.    End Sub
  37.  


Código
  1. 'Imprimir
  2.    Private Sub Print()
  3.        If m_streams Is Nothing OrElse m_streams.Count = 0 Then
  4.            Throw New Exception("Error: no stream to print.")
  5.        End If
  6.        AddHandler printdoc.PrintPage, AddressOf ImprimirPagina
  7.        m_currentPageIndex = 0
  8.        printdoc.Print()
  9.    End Sub
  10.  
  11.  


Código
  1.  
  2. 'Imprime el reporte
  3.    Public Sub imprimir_reporte(ByRef report As LocalReport, ByVal page_width As Integer, ByVal page_height As Integer, _
  4.                                      Optional ByVal islandscap As Boolean = False, _
  5.                                      Optional ByVal printer_name As String = Nothing)
  6.  
  7.        printdoc = New PrintDocument()
  8.        If printer_name <> Nothing Then printdoc.PrinterSettings.PrinterName = printer_name 'Obtiene el nombre de la impresora.
  9.  
  10.        If Not printdoc.PrinterSettings.IsValid Then 'Detecta si tiene configuración válida
  11.            Throw New Exception("Cannot find the specified printer")
  12.        Else
  13.  
  14.  
  15.            Dim ps As New PaperSize("Custom", page_width, page_height)
  16.            printdoc.DefaultPageSettings.PaperSize = ps
  17.            printdoc.DefaultPageSettings.Landscape = islandscap
  18.            Exportar(Me.ReportViewer1.LocalReport)
  19.            Print()
  20.  
  21.        End If
  22.    End Sub
  23.  
  24.  

Código
  1.  
  2. Private Sub ImprimirPagina(ByVal sender As Object, ByVal ev As PrintPageEventArgs)
  3.        Dim pageImage As New Metafile(m_streams(m_currentPageIndex))
  4.  
  5.        ' Adjust rectangular area with printer margins.
  6.        Dim adjustedRect As New System.Drawing.Rectangle(ev.PageBounds.Left - CInt(ev.PageSettings.HardMarginX),
  7.                                          ev.PageBounds.Top - CInt(ev.PageSettings.HardMarginY), _
  8.                                          ev.PageBounds.Width, _
  9.                                          ev.PageBounds.Height)
  10.  
  11.        ' Draw a white background for the report
  12.        ev.Graphics.FillRectangle(Brushes.White, adjustedRect)
  13.  
  14.        ' Draw the report content
  15.        ev.Graphics.DrawImage(pageImage, adjustedRect)
  16.  
  17.        ' Prepare for the next page. Make sure we haven't hit the end.
  18.        m_currentPageIndex += 1
  19.        ev.HasMorePages = (m_currentPageIndex < m_streams.Count)
  20.    End Sub
  21.    'Crea un stream
  22.    Private Function CreateStream(ByVal name As String, ByVal fileNameExtension As String, ByVal encoding As System.Text.Encoding, ByVal mimeType As String, ByVal willSeek As Boolean) As Stream
  23.        Dim stream As Stream = New MemoryStream()
  24.        m_streams.Add(stream)
  25.        Return stream
  26.    End Function
  27.  
  28.  


52  Programación / .NET (C#, VB.NET, ASP) / Imprimir report rdlc vs 2010 vb.net , Consulta en: 12 Octubre 2015, 23:10 pm
Buenas, estoy tratando de realizar un POS y pues ya puedo meter los datos en la base de datos y ya tengo mi archivo rdlc con la personalización que necesito, pues como ustedes saben las impresoras POS tienen ciertas medidas, pues tengo el reporte con el formato definido y sus respectivos parámetros.

Necesito agarrar ese reporte e imprimirlo directamente en la impresora sin vista previa, ya he visto varios enlaces como por ejemplo este

https://msdn.microsoft.com/en-us/library/ms252091.aspx

Y pues me parece un poco engorroso ese código y sobretodo no me sirve, sólo errores. También veo en ese código que ellos definen los datos del tamaño y el formato, pues yo ya tengo el reporte hecho el diseñador del VS lo cuál creo que no necesito definirselo ahí.


Necesito pasarle los parámetros al reporte para hacer correctamente la consulta, donde ya tengo mis datasets definidos, entonces sinceramente no se como hacer para llenar ese reporte y poder imprimirlo. Ya que antes simplemente ponía un control de report viewer y el me lanzaba el dialogo para imprimirlo, pero como es para facturas necesito que no se vea.


Código
  1.  
  2. Private Sub imprimir_reporte()
  3.  
  4.        Dim FACT As New ReportParameter("FACT", lbl_Consecutivo.Text)
  5.        Dim deviceInfo As String = "<DeviceInfo><OutputFormat>EMF</OutputFormat><PageWidth>8.5in</PageWidth><PageHeight>11in</PageHeight><MarginTop>0.25in</MarginTop><MarginLeft>0.25in</MarginLeft><MarginRight>0.25in</MarginRight><MarginBottom>0.25in</MarginBottom></DeviceInfo>"
  6.  
  7.        Dim report As New LocalReport()
  8.  
  9.        Try
  10.  
  11.            Me.Tbl_DETAILTableAdapter1.Fill(Me.FacturacionDataSet1.tbl_DETAIL)
  12.            Me.Tbl_HEADERTableAdapter1.Fill(Me.FacturacionDataSet11.tbl_HEADER)
  13.  
  14.            'report.ReportPath = "..\..\Report2.rdlc"
  15.  
  16.            report.DataSources.Add(New ReportDataSource("HEADER", Me.Tbl_HEADERTableAdapter1.Fill(Me.FacturacionDataSet11.tbl_HEADER)))
  17.            report.DataSources.Add(New ReportDataSource("DETAIL", Me.Tbl_HEADERTableAdapter1.Fill(Me.FacturacionDataSet11.tbl_HEADER)))
  18.  
  19.            report.SetParameters((New ReportParameter() {FACT}))
  20.  
  21.            report.ReportEmbeddedResource = "Report2.rdlc"
  22.  
  23.  
  24.  
  25.        Catch ex As Exception
  26.            MessageBox.Show(ex.ToString)
  27.        End Try
  28.    End Sub
  29.  
  30.  
  31.  


Ese es el código que tengo, realmente yo tenía el código para imprimir y que a ese reporte le lleguen los datos del dataset les agradezco pero como les digo se hace realmente engorroso y da errores.

Con respecto a los datos del dataset pues he visto que uno le define el datasource, y le mando por medio de parámetros el adapter, dataset pero en ninguna parte de mi rdlc necesito hacer eso y pues me tiene confundido.

Si uds serían tan amables de darme una guía se los agradezco mucho


GRACIAS POR LEER.
53  Programación / .NET (C#, VB.NET, ASP) / Re: Consulta Escritorio Remoto VB.NET 2010 en: 6 Octubre 2015, 00:33 am
Nadie?, les agradecería mucho la ayuda.
54  Programación / .NET (C#, VB.NET, ASP) / Re: Consulta Escritorio Remoto VB.NET 2010 en: 2 Octubre 2015, 16:02 pm
Me faltó algún dato? Si necesitan alguno con gusto se los daré. Gracias!!
55  Programación / .NET (C#, VB.NET, ASP) / Consulta Escritorio Remoto VB.NET 2010 en: 2 Octubre 2015, 00:24 am
Buenas,

Estoy haciendo una especie de team viewer, aunque sea pequeñito, esto con el fin de conectarme fácilmente, donde estoy usando vs 2010 con vb.net.

Estoy usando la librería  MSTSCLib y la referencia es AxInterop.MSTSCLib y también agregué esta Interop.MSTSCLib, en resumen agregué la referencia Microsoft Terminal Services Active Client 1.0 Type Library.


Pues resulta que he visto el código y pues no he podido echarlo a andar pues no me conecta, el "panel" no hace nada.

Código
  1.  
  2. Try
  3.  
  4.            Dim secured As IMsTscNonScriptable
  5.  
  6.            Pnl_Remoto.Server = txtServidor.Text
  7.            Pnl_Remoto.UserName = txt_Usuario.Text
  8.  
  9.  
  10.            secured = CType(Pnl_Remoto.GetOcx(), IMsTscNonScriptable)
  11.            secured.ClearTextPassword = txtContraseña.Text
  12.  
  13.            Pnl_Remoto.Connect()
  14.  
  15.        Catch ex As Exception
  16.  
  17.            MsgBox("No se pudo conectar" + vbCrLf + "Error:" + vbCrLf + ex.Message.ToString(), MessageBoxButtons.OK, MessageBoxIcon.Error)
  18.        End Try
  19.  
  20.  


Saben algo que tenga que agregarle, instalarle que estoy haciendo mal?

Saludos, gracias por leer.
56  Programación / .NET (C#, VB.NET, ASP) / Re: Consulta traslado de proyecto visual studio 2010 C# en: 11 Agosto 2015, 06:11 am
Te agradezco el tiempo que te tomaste para leer y responder!, voy a revisarlo, gracias.
57  Programación / .NET (C#, VB.NET, ASP) / Re: Consulta traslado de proyecto visual studio 2010 C# en: 11 Agosto 2015, 00:41 am
Si necesitan más datos por favor pídanlos!
58  Programación / .NET (C#, VB.NET, ASP) / Consulta traslado de proyecto visual studio 2010 C# en: 8 Agosto 2015, 06:02 am
Hola, me da pena consultar esto pero sinceramente no se porque no me funciona.

Hice un proyecto de c# en visual studio .net 2010 y necesito pasarlo a un compañero para que el lo continúe, el proyecto pues es algo muy básico y está hecho en capas, en buena teoría simplemente es pasarle todo el folder del proyecto y que el lo abra y lo continúe pero no se porque cuando el lo abre le aparece vacío y verdaderamente necesito que el lo continúe puesto que yo ya hice mi parte y no deseo seguirlo puesto que lo haría todo ¬¬.


Yo simplemente copio y pego el proyecto de la carpeta projects de visual studio y se lo paso, se supone que el con el visual studio lo abre y listo , no ?

El proyecto no lleva referencias, más que las mismas de las capas, es decir capa presentación, lógica y base de datos. Con respecto a los imports pues son de sql server y sqlserver data, nada que no traiga el visual studio.

Que más debo hacer???


GRACIAS POR LEER.

59  Programación / .NET (C#, VB.NET, ASP) / Re: Duda Login SQL_Server 2008, Must_Change desde la aplicación en: 26 Junio 2015, 07:27 am
Si necesitan algún detalle por favor hacermelo saber, con gusto se los daré saber. No se si pude bien explicarme, de igual forma gracias por tomarse el tiempo de leerme.
60  Programación / .NET (C#, VB.NET, ASP) / Re: Duda Login SQL_Server 2008, Must_Change desde la aplicación en: 26 Junio 2015, 00:04 am
Nadie?
Páginas: 1 2 3 4 5 [6] 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines