×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

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

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

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

(OP)
Hi!
I've been using Visual C++ for 3/4 days. I've bought a book "SAMS Teach Yourself Visual C++ 6 in 21 Days." 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 "Static Text" field; where the default message is "Place you message here". Now at this time if I clicked "Show Message" button, the default message is shown to the user but if I changed it to "This is a test" it still shows the default message "Place you message here". Here is what I've written in "Show Message" button codes;

Void CDay2Dlg::OnShwmsg()
{
// TODO: Add your control notification.......

// Update the message variable with what the user entered
UpdateData(TRUE);

// Display the message for the user
MessageBox(m_strMessage);
}

What is wrong in the program? Why doesn't it shows what the user had typed in the "Static Text" field?

Now, there are other buttons too; "Default Message" and "Clear Message" buttons. The book doesn't contain any information about "Default Message" button. So does this means we don't have to write any codes for "Default Message" button? The "Clear Message" button works perfectly. If I clicked on "Clear Message" button the default message is deleted.

I must be doing something wrong here. Please help me.

Thanks in advance!

Regards,
Monalisa

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

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.

Sorry but I can't come up with anything more descriptive.

Take care...dex

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close