/ Published in: VB.NET
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
Private Sub AddData() Dim NewRow As DataRow = frmBuildingEditor.dsBill.BILL.NewRow Try NewRow("IssuedDate") = CStr(DateTime.ParseExact(NewDate, My.Settings.DateFormat, iCultureInfo)) NewRow("Description") = frmBuildingEditor.ValidateInput(txtDesc.Text) NewRow("Amount") = frmBuildingEditor.ValidateInput(CDbl(txtAmount.Text)) NewRow("Status") = frmBuildingEditor.ValidateInput(cmbStatus.Text) NewRow("LotID") = frmBuildingEditor.ValidateInput(frmBuildingEditor.lblID.Text) Catch ex As Exception uProceed = False MessageBox.Show("Please check your input.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error) End Try If uProceed = True Then Try frmBuildingEditor.dsBill.BILL.Rows.Add(NewRow) frmBuildingEditor.daBill.Update(frmBuildingEditor.dsBill) MessageBox.Show("New Shop Lot successfully registered.", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information) frmPersona.AddLog(String.Format("[+] Added bills [ID:{0}..]", frmBuildingEditor.dsBill.BILL.Rows(frmBuildingEditor.dsBill.BILL.Rows.Count - 1).Item(0).ToString)) frmBuildingEditor.ReloadBills() Catch ex As Exception MessageBox.Show("Ops! There's an error occurred while adding data.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error) End Try End If End Sub