Imports System.Data.OleDb
Public Class AddClient
    Private dbc As New OleDbConnection(conStr)
    Private Sub AddClient_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        Me.Show()
        Dim dba As New OleDbDataAdapter("SELECT * FROM tbClient", dbc)
        Dim dbset As New DataSet
        dba.Fill(dbset)
        Me.DataGridView1.DataSource = dbset.Tables(0).DefaultView
    End Sub

    Private Sub TextBox1_TextChanged(sender As Object, e As EventArgs) Handles TextBox1.TextChanged
        Dim dba As New OleDbDataAdapter("SELECT * FROM tbClient WHERE CName LIKE '%" & Me.TextBox1.Text & "%'", dbc)
        Dim dbset As New DataSet
        dba.Fill(dbset)
        Me.DataGridView1.DataSource = dbset.Tables(0).DefaultView
    End Sub

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

            frmMain.TextBox2.Text = Me.TextBox2.Text
        MessageBox.Show("Successfully Added!")
        Me.Hide()



    End Sub

    Private Sub DataGridView1_CellClick(sender As Object, e As DataGridViewCellEventArgs) Handles DataGridView1.CellClick
        Dim i As Integer = DataGridView1.CurrentRow.Index
        Me.TextBox2.Text = DataGridView1.Item(1, i).Value

    End Sub
End Class