Imports System.IO
Imports System.Data.OleDb
Public Class Form3
    Dim conn As String
    Dim printsql As String
    Dim rpt As CrystalReport4
    Dim dv As DataView
    Dim dset As DataSet


    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        Form7.CrystalReportViewer1.ReportSource = rpt
        Form7.Show()
    End Sub

    Private Sub Form3_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim sql As String
        Dim tbladp As OleDbDataAdapter
        conn = "provider=Microsoft.jet.oledb.4.0;data source=" & Application.StartupPath & "\Test_Evren.mdb"
        sql = "select * from tablo1;"
        dset = New DataSet
        tbladp = New OleDb.OleDbDataAdapter(sql, conn)
        tbladp.Fill(dset, "tablo1")
        dv = New DataView
        dv.Table = dset.Tables("Tablo1")
        DataGridView1.DataSource = dv
        rpt = New CrystalReport4
        rpt.SetDataSource(dv)
        DataGridView1.Columns(0).Width = 70
        DataGridView1.Columns(1).Width = 250
        DataGridView1.Columns(2).Width = 70
        Call renklen()
    End Sub

    Private Sub DataGridView1_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellContentClick

    End Sub

    Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
        dv = New DataView
        dv.Table = dset.Tables("Tablo1")
        dv.AllowDelete = True
        dv.AllowEdit = True
        dv.AllowNew = True
        dv.RowFilter = "Adi_soyadi like '" & TextBox1.Text & "*'"
        DataGridView1.DataSource = dv
        'DataGridView1.DataSource = dset.Tables("tablo1")
        rpt = New CrystalReport4
        rpt.SetDataSource(dv)
        Call renklen()
    End Sub
    Sub renklen()
        For i = 0 To DataGridView1.RowCount - 1
            If i Mod 2 = 0 Then
                DataGridView1.Rows(i).DefaultCellStyle.BackColor = Color.DeepPink
                DataGridView1.Rows(i).DefaultCellStyle.ForeColor = Color.White
            Else
                DataGridView1.Rows(i).DefaultCellStyle.BackColor = Color.Cyan
                DataGridView1.Rows(i).DefaultCellStyle.ForeColor = Color.Red
            End If

        Next
    End Sub
End Class