Click here to Skip to main content
15,899,474 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Is there any option other than on button click event, so that I can set text in Edit Box.
Posted
Updated 13-Apr-15 2:16am
v2
Comments
Style-7 13-Apr-15 8:03am    
What do you want? See SetWindowText or SetDlgItemText.
What event? Describe more.
Richard MacCutchan 13-Apr-15 8:17am    
Yes, you can set the text anywhere in your application. Either as the result of some event or during normal operations.
Member 11482033 13-Apr-15 8:25am    
For setting data into edit box from other class, I need to write an event like on button click. But in my case, I need to set data directly without event.
Member 11482033 13-Apr-15 8:19am    
actually I need to do is, I am having a modeless dialog while clicking on OK button I need to pass some data on other dialog edit box. I am setting that data in Dialog constructor, But its assertion failed message is coming.
I need help.. Thanks in advanced
Richard MacCutchan 13-Apr-15 8:43am    
Sorry, but we cannot see your screen or read your mind. Please edit your question and show the failing code and explain exactly what is happening.

You can set the text in any function you want, but you must distinguish between the pure SetWindowText and member value of an "connected" variable. Here is some example.

Important is that your calls are in the main-thread. If not use a PostThreadMessage with a handler.
 
Share this answer
 
You should set the edit box text in the OnInitDialog method. See MSDN: "Initializing the Dialog Box"[^].
 
Share this answer
 

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