Imports System.Data
Imports System.Data.OleDb
Public Class Form2
Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
If example.Text = "ID Code" Then
sql = "select * from factory1 where ID_Code Like '" & TextBox1.Text & "%'"
ElseIf example.Text = "Plt Bld Id" Then
sql = "select * from factory1 where Plt_Bld_Id Like '" & TextBox1.Text & "%'"
ElseIf example.Text = "Tsic Id" Then
sql = "Select * from factory1 where Tsic_Id like '" & TextBox1.Text & "%'"
ElseIf example.Text = "Id No" Then
sql = "Select * from factory1 where Id_No like '" & TextBox1.Text & "%'"
ElseIf example.Text = "Number Factory" Then
sql = "Select * from factory1 where Number_Factory like '" & TextBox1.Text & "%'"
ElseIf example.Text = "Type code factory" Then
sql = "Select * from factory1 where Type_code_factory like '" & TextBox1.Text & "%'"
ElseIf example.Text = "Industry" Then
sql = "Select * from factory1 where Industry like '" & TextBox1.Text & "%'"
ElseIf example.Text = "Corporate Name" Then
sql = "Select * from factory1 where Corporate_Name like '" & TextBox1.Text & "%'"
ElseIf example.Text = "Factory_Building" Then
sql = "Select * from factory1 where Factory_Building like '" & TextBox1.Text & "%'"
ElseIf example.Text = "Trader" Then
sql = "Select * from factory1 where Trader like '" & TextBox1.Text & "%'"
ElseIf example.Text = "Name Contract" Then
sql = "Select * from factory1 where Name_Contract like '" & TextBox1.Text & "%'"
ElseIf example.Text = "Date control" Then
sql = "Select * from factory1 where Date_control like '" & TextBox1.Text & "%'"
ElseIf example.Text = "Acc responsible" Then
sql = "Select * from factory1 where Acc_responsible like '" & TextBox1.Text & "%'"
ElseIf example.Text = "Address" Then
sql = "Select * from factory1 where Address like '" & TextBox1.Text & "%'"
ElseIf example.Text = "Address Estate" Then
sql = "Select * from factory1 where Address_Estate like '" & TextBox1.Text & "%'"
ElseIf example.Text = "Group" Then
sql = "Select * from factory1 where Group like '" & TextBox1.Text & "%'"
ElseIf example.Text = "Road" Then
sql = "Select * from factory1 where Road like '" & TextBox1.Text & "%'"
ElseIf example.Text = "District" Then
sql = "Select * from factory1 where District like '" & TextBox1.Text & "%'"
ElseIf example.Text = "Zone" Then
sql = "Select * from factory1 where Zone like '" & TextBox1.Text & "%'"
ElseIf example.Text = "Province" Then
sql = "Select * from factory1 where Province like '" & TextBox1.Text & "%'"
ElseIf example.Text = "Post Code" Then
sql = "Select * from factory1 where Post_Code like '" & TextBox1.Text & "%'"
ElseIf example.Text = "Number" Then
sql = "Select * from factory1 where Number like '" & TextBox1.Text & "%'"
ElseIf example.Text = "NumberFax" Then
sql = "Select * from factory1 where NumberFax like '" & TextBox1.Text & "%'"
ElseIf example.Text = "Expr1014" Then
sql = "Select * from factory1 where Expr1014 like '" & TextBox1.Text & "%'" ElseIf example.Text = "Transformer size (kVA) SUM" Then
sql = "Select * from factory1 where Transformer_size like '" & TextBox1.Text & "%'"
ElseIf example.Text = "Size kW approval SUM" Then
sql = "Select * from factory1 where Size_kW_approval like '" & TextBox1.Text & "%'"
End If
dt.Clear()
da = New OleDbDataAdapter(sql, Conn)
da.Fill(dt)
dtg.DataSource = dt
End Sub
Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
sql = "Select * from factory1"
da = New OleDbDataAdapter(sql, Conn)
da.Fill(dt)
dtg.DataSource = dt
End Sub
Private Sub example_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles example.SelectedIndexChanged