Click here to Skip to main content
15,916,189 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
we write some text in edit box and click on button edit box search item from tree control if edit box text and tree control item matches item( node or root) then delete item from tree plz reply me its urgent
Posted
Comments
Richard MacCutchan 28-Feb-12 11:36am    
Urgent reply: what is your problem?
JackDingler 28-Feb-12 15:23pm    
BTW, No need to post in the solution boxes with additional questions.

You can update your solution or click, "Have a Question or Comment", to clarify further.

Iterating the CTreeCtrl is done with the methods : CTreeCtrl::GetChildItem, CTreeCtrl::GetNextItem, ...

Comparing the text in the edit box and the tree item :
- CEdit::GetWindowText to get the text of the edit box.
- CTreeCtrl::GetItemText to get the text of the tree item.

Removing the item when the texts are identical:
- CTreeCtrl::DeleteItem

Have a look at the documentation for the CTreeCtrl on MSDN.

(I'll leave googling for the documentation and example/tutorial as an exercise).
 
Share this answer
 
Comments
theking3421 28-Feb-12 12:29pm    
Sir Plz Tell me step By Step How its working .I m new in mfc plz sir reply me where i write code of ctreeCtrl Thanks in advance
theking3421 28-Feb-12 12:59pm    
thanx sir i'll try
theking3421 28-Feb-12 14:22pm    
Sir plz tell me how i write this Iterating the CTreeCtr method and in which function
how i am comparing the text in the edit box and the tree item :
- CEdit::GetWindowText to get the text of the edit box.
- CTreeCtrl::GetItemText to get the text of the tree item.
sir i m new in mfc i m begineer plz tell me how and where we write this code plz sir reply thanks in advance and gud night
Maximilien 28-Feb-12 14:36pm    
It should all be there in the documentation, and there are many, many examples and tutorials on the web.

Learn to use the documentation, it is very useful.

I assume your learning is part of a course, then there should text and examples already available for you to use, also, talk to your friends and ask questions to your teacher and/or lab assistant.

Good luck.
M.
Sir Plz Tell me step By Step How its working .I m new in mfc plz sir reply me where i write code of ctreeCtrl Thanks in advance
 
Share this answer
 
Now I'm glad I didn't take the time to discuss Tree Control indexing....

I recommend you read and understand the documentation for the functions that Max mentioned.

As to the steps...

1. Get the next control (Will be the first at start).
2. Examine the text. Does it match? If so you're done.
3. Are there children? If so, get the handle of the first child and recurse to #1.
4. At then end? If so, then quit. No match found.
5. Go to #1
 
Share this answer
 
Sir plz tell me how i write this Iterating the CTreeCtr method and in which function
how i am comparing the text in the edit box and the tree item :
- CEdit::GetWindowText to get the text of the edit box.
- CTreeCtrl::GetItemText to get the text of the tree item.
sir i m new in mfc i m begineer plz tell me how and where we write this code plz sir reply thanks in advance and gud night
 
Share this answer
 
Comments
JackDingler 28-Feb-12 14:49pm    
We're not here to do your homework for you. You'll have to put in some effort if you want to learn.

Do you know how to compare two strings? That's what you'll be doing here. you get the text string from the edit window and the text string from the Tree Item, and you see if they are the same.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900