How to change the name of a button

Bryan Kelly 486 Reputation points
2025-03-14T20:00:59.7866667+00:00

Windows 11, VS 2022, Version 17.13.3, C++, MFC project

I created a new MFC project, first one since the install, accepting most of the defaults.  The project opened with the initial GUI ready to edit.  A new button was added.  Right click on the new button, select Properties, and attempt to name the button.  More correctly, I suspect, change the ID of the button.  In group Misc the “(Name)” field is not editable.  I prefer the button name, or ID is that is preferred, to be something like IDC_Show_Addition.

What are the steps to change the name of the button?

A Copilot Answer suggests simply open the dialog and edit the name.  The name field cannot be edited.

A two year old stackoverflow post stated the MFC is not a good project template, but following the links did not discover the answer.

Another question:  I want a starter project that begins with GUIs (dialogs) that I can edit and add.  I strongly prefer C++.  The MFC project starts out just right.  This is a personal project at home.  After that stackoverflow question I need to ask: Have you any suggestions for a project template?

Side issue:  Used ctl-h to replace all, but the dialog does not have a button to actually replace.  This was quite surprising.  Changed all the names in the entire solution by searching them out one at a time and use ctl-v to replace.  That seems to have worked.  Will this cause problems in the future?  I suspect there is much better method.

find_replace

There is no button for the action of "Replace" or "Replace All"

Community Center Not monitored
{count} votes

1 answer

Sort by: Most helpful
  1. RLWA32 49,536 Reputation points
    2025-03-15T07:00:17.4933333+00:00

    In the properties pane for the button control change the control's ID. Your change will automatically be reflected in the Misc group (Name) field. There is no need to use Find/Replace.

    Before -

    BeforeProps

    After -

    AfterProps

    Don't forget that code refers to resources by their IDs.

    You wrote "The MFC project starts out just right." Seems to me there's nothing else to do here.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.