Here's the code
Imports
Public
#
InitializeComponent()
components.Dispose()
<System.Diagnostics.DebuggerStepThrough()>
txtamnt.Text = Val(txtpurprice.Text) * Val(txtquant.Text)
dt =
com.CommandText = com.CommandText & "'" & cbodealid.Text & "','" & txtdealname.Text & "','" & cbocompntid.Text & "','" & txtcompnt.Text & "','" & cbomanufacturer.Text & "','" & cbomodel.Text & "'," & txtpurprice.Text & "," & txtquant.Text & "," & txtamnt.Text & ",'" & dt & "')"
con.Open()
saveSuccess =
MsgBox(ex.Message)
con.Close()
MsgBox("Purchase cannot be added", MsgBoxStyle.Critical, "Error in Saving")
MsgBox("purchase was successfully added", MsgBoxStyle.Information, "Customer Added")
btncancel.PerformClick()
txtdate.Text = Now.ToShortDateString
r = com.ExecuteReader
cbodealid.Items.Add(r("DealID"))
cbocompntid.Items.Add(r("CompntID"))
txtcompnt.Text = ""
cbomanufacturer.Text = ""
cbomodel.Text = ""
txtdealname.Text = ""
r =
cbodealid.SelectedIndex = 0
cbocompntid.SelectedIndex = 0
k = com1.ExecuteReader
k.Read()
newCompID = Val(k(0) + 1).ToString
k =
txtpurid.Text = newCompID
filCon.Open()
filR = filCom.ExecuteReader
filR.Read()
txtdealname.Text = filR("DealerName")
filR =
filCon.Close()
txtcompnt.Text = filR("CompntName")
cbomanufacturer.Text = filR("Company")
cbomodel.Text = filR("CompntModel")
End