Private Sub btnSearch_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSearch.Click
Dim data As DataRow
Try
OleDbDataAdapter1.Fill(Me.DataSet11.PAYMENT)
data = DataSet11.PAYMENT.Rows.Find(txtpayment.Text)
txtpayment.Text = data("CustomerIC")
txtName.Text = data("CustomerName")
txtadd.Text = data("CustomerAddress")
txttel.Text = data("NoTel")
If cKurung.AutoCheck = True Then
cKurung.Checked = data("Baju Kurung")
Quan1 = Convert.ToInt32(txtQ1.Text)
Quan1 = data("Quantity1")
End If
If cKebaya.AutoCheck = True Then
cKebaya.Checked = data("Baju Kebaya")
Quan2 = Convert.ToInt32(txtQ2.Text)
Quan2 = data("Quantity2")
End If
If cTudung.AutoCheck = True Then
cTudung.Checked = data("Tudung")
Quan3 = Convert.ToInt32(txtQ3.Text)
Quan3 = data("Quantity3")
End If
If cSelendang.AutoCheck = True Then
cSelendang.Checked = data("Selendang")
Quan4 = Convert.ToInt32(txtQ4.Text)
Quan4 = data("Quantity4")
End If
If cTelekung.AutoCheck = True Then
cTelekung.Checked = data("Telekung")
Quan5 = Convert.ToInt32(txtQ5.Text)
Quan5 = data("Quantity5")
End If
If cAnakTudung.AutoCheck = True Then
cAnakTudung.Checked = data("Anak Tudung")
Quan6 = Convert.ToInt32(txtQ6.Text)
Quan6 = data("Quantity6")
End If
txtQuan.Text = data("Quantity")
txtPrice.Text = data("Price")
Catch ex As Exception
MessageBox.Show("Invalid Customer IC", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
txtpayment.Text = ""
txtpayment.Focus()
txtpayment.ReadOnly = False
End Try
End Sub
这是我的代码。调用 Quantity 而不是 Quantity1 会引发错误。例如,在其他表格中,我只填写数量1,但其他数量我不填写,然后当我想查找数据时它会出错。