---
title: "How to change the Text of a CButton at Runtime?"  
description: "How to change the Text of a CButton at Runtime?"  
author: "Dependra Pathak"  
published: 2011-03-28  
updated: 2020-09-23  
canonical: https://www.mindstick.com/interview/670/how-to-change-the-text-of-a-cbutton-at-runtime  
category: "visual c++"  
tags: ["visual c++"]  
reading_time: 1 minute  

---

# How to change the Text of a CButton at Runtime?

CButton *btnsample= (CButton *)GetDlgItem(IDC_BUTTON1); //suppose IDC_BUTTON1 is the ID of CButton\
btnsample->SetWindowText(_T("Lahore"));

## Answers

### Answer by Dependra Pathak

CButton *btnsample= (CButton *)GetDlgItem(IDC_BUTTON1); //suppose IDC_BUTTON1 is the ID of CButton\
btnsample->SetWindowText(_T("Lahore"));


---

Original Source: https://www.mindstick.com/interview/670/how-to-change-the-text-of-a-cbutton-at-runtime

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
