jessica
jessica

Reputation: 13

how do I set a value of a textbox in Visual C++

how do I set a value of a textbox in Visual C++? I have been trying the following but the line strTemp.Format("%d", nNbr); does not compile thanks

        int nNbr = 5;
    CString strTemp;
    strTemp.Format("%d", nNbr);

    textBox.SetWindowTextW(strTemp);

Upvotes: 1

Views: 3467

Answers (1)

Frédéric Hamidi
Frédéric Hamidi

Reputation: 262979

You probably need to use the _T macro in order to support both ANSI and UNICODE builds of your application:

int nNbr = 5;
CString strTemp;
strTemp.Format(_T("%d"), nNbr);
textBox.SetWindowText(strTemp);

Upvotes: 1

Related Questions