Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I display the message what the user had typed in "Static Text"?

Status
Not open for further replies.

Monalisa

Programmer
Jun 25, 2000
6
NP
Hi!<br> I've been using Visual C++ for 3/4 days. I've bought a book &quot;SAMS Teach Yourself Visual C++ 6 in 21 Days.&quot; I'm now on the Day 2 of the book. But I've a problem while displaying the message to the user. If you have the book that will be great if not then I'll try to give details of the program as much as I could. I wrote a program as told in the book. The program is suppose to show the user what he had typed in the &quot;Static Text&quot; field; where the default message is &quot;Place you message here&quot;. Now at this time if I clicked &quot;Show Message&quot; button, the default message is shown to the user but if I changed it to &quot;This is a test&quot; it still shows the default message &quot;Place you message here&quot;. Here is what I've written in &quot;Show Message&quot; button codes;<br> <br> Void CDay2Dlg::OnShwmsg()<br> {<br> // TODO: Add your control notification.......<br> <br> // Update the message variable with what the user entered<br> UpdateData(TRUE);<br> <br> // Display the message for the user<br> MessageBox(m_strMessage);<br> }<br> <br> What is wrong in the program? Why doesn't it shows what the user had typed in the &quot;Static Text&quot; field?<br> <br> Now, there are other buttons too; &quot;Default Message&quot; and &quot;Clear Message&quot; buttons. The book doesn't contain any information about &quot;Default Message&quot; button. So does this means we don't have to write any codes for &quot;Default Message&quot; button? The &quot;Clear Message&quot; button works perfectly. If I clicked on &quot;Clear Message&quot; button the default message is deleted.<br> <br>I must be doing something wrong here. Please help me.<br> <br>Thanks in advance!<br><br>Regards, <br>Monalisa
 
I don't think I understand correctly what you mean but as far as I am informed StaticText control is only for visualizing text in the App's form not for user input. I guess that's why it is Static?! To get input from the user you need to use an Edit field. I suppose you get one and the same message because the user cannot type in your StaticText and it never changes its caption.<br><br>Sorry but I can't come up with anything more descriptive.<br><br>Take care...dex
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top