private void btnSave_ItemClick(object sender, ItemClickEventArgs e) { try { acc.Add(new DALLayer.Accounts() { accCode = txtAccCode.Text, accName = txtAccName.Text, MainAccCode = txtMainAccountCode.Tag.ToString(), accLevel = int.Parse(txtAccLevel.Text), typeCode = int.Parse(AccountType.EditValue.ToString()), AllowManualEntry = AllowManualEntry.Checked }); MessageBox.Show("success"); btnSave.Enabled = false; btnAddNew.Enabled = btnModify.Enabled = btnDelete.Enabled = true; TreeNode child = new TreeNode(txtAccCode.Text + "--" + txtAccName.Text); child.Tag = txtAccCode.Text; node.Nodes.Add(child); AccountTree_AfterSelect(null, null); } catch (Exception ex) { MessageBox.Show(ex.Message); } }