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 to put data into a edit box

how to put data into a edit box

how to put data into a edit box

I am trying to put data into a edit box.  How do I activate the box so that I can work with it?  

What happens is the user inputs a filename in one edit box, and then presses tab to get to the next edit box.  I want to take the filename from the first edit box, cat a file extension on it, and then write the new name in the second edit box.  

I have a default value in the edit box, so when the user tabs to that box, it is highlighted, but I want to actually delete the default, and replace it with the value from the first edit box with a new file extension.

Any suggestions?

RE: how to put data into a edit box


Say you use the Class Wizard to create two variables of type 'Control' one each for the edit boxes named '_oEdit1' and '_oEdit2'.

Now use the Class Wizard to create a handler function for the second edit boxes WM_SETFOCUS message, then in that handler you could do this.

CString sStr;
_oEdit1.GetWindowText( sStr);
// perform string manipulation to add file extension

_oEdit2.SetWindowText( sStr);

Of course you might want the handler to be for the first edit box's WM_LOSTFOCUS message.

Good luck

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