0
Good afternoon. I’m trying to work with TreeNode
s, I would like to do a search based on the Text properties of my Name, but I’m not getting the expected result.
What I wanted to appear to me was just the part that says Album1
(which is my text property). I also leave below my respective code. Do not mind the conditions in my if
because it was just another attempt to get the desired. What the conditions do is just show Album1
, but not the nodes inside.
void FindRecursive2(TreeNode ^treeNode)
{
System::Collections::IEnumerator^ myNodes = (safe_cast<System::Collections::IEnumerable^>(treeNode->Nodes))->GetEnumerator();
while (myNodes->MoveNext())
{
// Responsável pela caixa de texto na imagem postada.
System::Windows::Forms::DialogResult result = MessageBox::Show(this, myNodes->Current->ToString());
if (treeNode->Text->ToString() == textBox4->Text || treeNode->Text->ToString() == textBox5->Text || treeNode->Text->ToString() == textBox6->Text)
treeNode->BackColor = System::Drawing::Color::ForestGreen;
TreeNode^ v2 = safe_cast<TreeNode^>(myNodes->Current);
FindRecursive2(v2);
}
}
I don’t quite understand what you want, but I think that
MessageBox::Show
should or should be protected by aif
, or be out of thewhile
or just show up after areturn
or something similar.– Victor Stafusa
The message box is just for me to test what is printed, I just wanted to print Album1. I don’t want the "treeNode to appear:"
– RADCP