DataGridView selected record print vb.net

Bishop BM 1 Reputation point
2021-06-20T14:41:27.12+00:00

"This is my code but print all records. pls help me pls. I want to search a record and print crystalreport.

Imports System.Data.SqlClient

Public Class Form1

Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
    '
    Me.Patient_tblTableAdapter.Fill(Me.DoctorDataSet.patient_tbl)

End Sub

Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click

    PatienttblBindingSource.Filter = "(Convert(ID,'System.String') LIKE '" & TextBox1.Text & "%')"
End Sub

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim rpt As New CrystalReport1
rpt.SetDataSource(DoctorDataSet)
Form2.CrystalReportViewer1.ReportSource = rpt

    Form2.ShowDialog()

End Sub

End Class

Developer technologies | VB
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.