01.
Private
Sub
frmListAllProducts_Load(
ByVal
sender
As
System.
Object
,
ByVal
e
As
System.EventArgs)
Handles
MyBase
.Load
02.
Windows.Forms.Cursor.Current = Cursors.WaitCursor
03.
04.
With
Conn
05.
If
.State = ConnectionState.Open
Then
.Close()
06.
.ConnectionString = strConn
07.
.Open()
08.
End
With
09.
10.
Dim
sqlBook
As
String
=
""
11.
sqlBook =
"SELECT t_Product.Product_id, t_Product.Product_name, t_Product.Product_Brand,"
12.
sqlBook &=
" t_Product.Product_Price, t_Product.Product_Detail, t_Product.Product_Total"
13.
sqlBook &=
" FROM t_Product"
14.
15.
16.
17.
18.
If
IsFind =
True
Then
19.
ds.Tables(
"t_Product"
).Clear()
20.
End
If
21.
22.
da =
New
OleDbDataAdapter(sqlBook, Conn)
23.
da.Fill(ds,
"t_Product"
)
24.
25.
If
ds.Tables(
"t_Product"
).Rows.Count <> 0
Then
26.
IsFind =
True
27.
28.
29.
With
grdProducts
30.
.AllowNavigation =
False
31.
.
ReadOnly
=
True
32.
.DataSource = ds.Tables(
"t_Product"
)
33.
End
With
34.
Else
35.
IsFind =
False
36.
grdProducts.DataSource =
Nothing
37.
End
If
38.
39.
FormatDataGridWithData()
40.
Windows.Forms.Cursor.Current = Cursors.
Default
41.
End
Sub