private void button5_Click(object sender, EventArgs e) { int i = 0; if (btphanloai.Text == "OK") { btphanloai.Text = "Phân loại"; comboBox1.Enabled = false; string str = treeView1.SelectedNode.Tag.ToString(); if (str.Substring(0, 2) == "PL") { MessageBox.Show("Bạn phải chọn sách cần đổi"); } else { if (s.phanloai(comboBox1.Text)) { string str1 = treeView1.SelectedNode.Tag.ToString(); string str2 = treeView1.SelectedNode.Text; treeView1.SelectedNode.Remove(); while (true) { if (treeView1.Nodes[i].Text == comboBox1.Text) { TreeNode n1 = new TreeNode(); n1.Tag = str1; n1.Text = str2; n1.ImageIndex = 0; treeView1.Nodes[i].Nodes.Add(n1); break; } i++; } MessageBox.Show("Bạn đã chuyển đổi thành công"); } } } else { btphanloai.Text = "OK"; comboBox1.Enabled = true; } }