![]()
So far all i have done, is copyed the ADD COMPANY code, and tried to change .addrow commands to something like .clear ... or .delrow
Is there even such a command?
How do you delete rows out of an access database?
VB Code:
Private Sub removebtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles removebtn.Click 'Remove a Company Dim dtcmp As DataRow = m_Company.ClearRow dtcmp("CompanyName") = companybox.Text dtcmp("Address") = addressbox.Text dtcmp("Phone") = phonebox.Text dtcmp("ABN") = abnbox.Text m_Company.Rows.Remove(dtcmp) m_DataAdapter.Update(m_Company) MessageBox.Show(companybox.Text & "has been deleted", _ "Message Type: CMP SAVED", MessageBoxButtons.OK, MessageBoxIcon.Information) m_Connection.Close() 'Add the Company Name in the List box... clientbox.Items.Remove(companybox.Text) Catch objException As Exception Dim what As MsgBoxResult what = MessageBox.Show("An Error Occurred: " & objException.Message, _ "Message Type: Error In NewCompany (fclsNewCompany)", MessageBoxButtons.OK, MessageBoxIcon.Error) End Try End Sub




Reply With Quote