Report Viewer using linq to sql and vb.net
Good morning, how to use the report viewer in vb.net using Linq to Sql?
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Ramesh MaruthiRank #937 · 2.2K reputationPosted Aug 11, 2014, 6:23 AM EDT
Please look at this links :)
http://blogs.msdn.com/b/bethmassi/archive/2009/08/19/using-the-reportviewer-with-ado-net-data-services-and-entity-framework.aspx
http://social.msdn.microsoft.com/Forums/en-US/7877c101-8920-4f3a-8a5e-0abe71f48c44/linq-as-a-datasource-for-reportviewer?forum=linqprojectgeneral
Daniel Rosa5 reputationPosted Aug 11, 2014, 9:04 AM EDT
What should I do to improve the code?
Private Sub TxtPesquisarNomeDocumento_TextChanged(sender As Object, e As EventArgs) Handles
TxtPesquisarNomeDocumento.TextChanged
Try
Dim ListaGeralPesquisaCodigoFuncao As IList(Of DAL.LT_DocIdentificacaoResult)
=
ListaGeralDocumentosIdent.Where(Function(w)
w.NOME_DOC_IDENTIFICAÇÃO.Contains(TxtPesquisarNomeDocumento.Text)).ToList()
CarregarGridDocumentos(ListaGeralPesquisaCodigoFuncao)
Catch ex As Exception
MsgBox("erro : " & ex.Message, MsgBoxStyle.Exclamation)
End Try
End Sub
Public Function DatagridviewToDataset() As System.Data.DataSet
Dim ds As New System.Data.DataSet
Try
'Add a new table to the dataset
ds.Tables.Add("Main")
'Add the columns
Dim col As System.Data.DataColumn
'For each colum in the
datagridveiw add a new column to your table
For Each dgvCol As DataGridViewColumn In DGVListaDocIdentificacao.Columns
col = New System.Data.DataColumn(dgvCol.Name)
ds.Tables("Main").Columns.Add(col)
Next
'Add the rows from the
datagridview
Dim row As System.Data.DataRow
Dim colcount As Integer =
DGVListaDocIdentificacao.Columns.Count - 1
For i As Integer = 0 To
DGVListaDocIdentificacao.Rows.Count - 1
row = ds.Tables("Main").Rows.Add
For Each column As DataGridViewColumn In DGVListaDocIdentificacao.Columns
row.Item(column.Index) =
DGVListaDocIdentificacao.Rows.Item(i).Cells(column.Index).Value
Next
Next
Return ds
Catch ex As Exception
'Catch any potential errors and
display them to the user
MessageBox.Show("Error Converting from
DataGridView" & ex.InnerException.ToString, _
"Error Converting from
DataGridView", MessageBoxButtons.OK, MessageBoxIcon.Error)
Return Nothing
End Try
End Function
Thanks