Visual Basic para Aplicaciones - pasar un Datagredview a un Reportviewer

Life is soft - evento anual de software empresarial
 
Vista:
Imágen de perfil de Ignacio

pasar un Datagredview a un Reportviewer

Publicado por Ignacio (7 intervenciones) el 28/02/2015 04:41:06
Necesito pasar el contenido de un datagredview a un reportviewer , he encontrado algunos ejemplos en internet pero no logro hacerlo, aca les dejo parte de mi codigo que me funciona perfecto, pero despues de mostrado quiero pasarlo a un reporviewer y poderlo imprimir.
Gracias de antemano.


Imports System.Data.OleDb
Imports System.Data
Imports System.Xml

Public Class Form4
Private WithEvents bs As New BindingSource

Dim StrConexion4 As String
Dim adapter4 As New OleDbDataAdapter
Dim dset As New DataSet
Dim p As Integer = 0

Private Sub Form4_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim camino As String = "D:\programacion\sistemas-economicos\validacion-indicadores\trunk\Sispres\SISPRES\"

Dim s As String = "SELECT * FROM indicadores"
Dim enlace As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & camino & "indicadorbd.mdb" & ";Persist Security Info=False"

cargar_registros(s, enlace)
End Sub

Private Sub cargar_registros( _
ByVal StrComando As String, _
ByVal StrConexion As String)

Dim nromes As Integer
Dim contents As String = ""
Dim oFileInfo As IO.FileInfo = Nothing

'conexion
adapter4 = New OleDbDataAdapter(StrComando, StrConexion)

adapter4.Fill(dset, "indicadores")
Me.DataGridView4.DataSource = dset.Tables("indicadores")

' Enlazar el BindingSource con el datatable anterior
' ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
bs.DataSource = dset

With DataGridView4
.Refresh()
' coloca el registro arriba de todo
.FirstDisplayedScrollingRowIndex = bs.Position
End With

End Sub
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