01.
Private
Sub
cmdAddPro_Click(
ByVal
sender
As
System.
Object
,
ByVal
e
As
System.EventArgs)
Handles
cmdAddPro.Click
02.
If
txtProID.Text =
""
Then
Exit
Sub
03.
If
CInt
(txtQty.Text) < 1
Then
04.
MessageBox.Show(
"จำนวนขายผิด"
)
05.
Exit
Sub
06.
End
If
07.
08.
Dim
i
As
Integer
= 0
09.
Dim
ListViewItem
As
ListViewItem
10.
Dim
tmpProid
As
String
11.
12.
For
i = 0
To
ListView1.Items.Count - 1
13.
tmpProid = ListView1.Items(i).SubItems(0).Text
14.
If
txtProID.Text = tmpProid
Then
15.
MessageBox.Show(
"เลือกรหัสสินค้าซ้ำ กรุณาตรวจสอบ หากต้องการขายสินค้าชนิดนี้เพิ่มเติมให้ทำการเคลียร์ข้อมูลสินค้าเดิมแล้วขายใหม่"
,
"ผลการตรวจสอบ"
, MessageBoxButtons.OK, MessageBoxIcon.Information)
16.
ClearProductData()
17.
Exit
Sub
18.
End
If
19.
Next
20.
21.
Dim
Data()
22.
23.
[font=Verdana] txtPrice.Text =
CStr
(txtProPrice.Text) *
CInt
(txtQty.Text)
24.
txtTotal.Text = (txtPrice.Text)[/font]
25.
26.
Data =
New
String
() { _
27.
txtNumber.Text, _
28.
txtProID.Text, _
29.
txtProName.Text, _
30.
txtQty.Text, _
31.
txtProPrice.Text, _
32.
txtPrice.Text, _
33.
txtMsn.Text}
34.
35.
ListViewItem =
New
ListViewItem(Data)
36.
ListView1.Items.Add(ListViewItem)
37.
38.
ClearProductData()
39.
CaltxtTotal()
40.
41.
End
Sub