New to Forms/MFC. Unsure where to place the code.
Hi,
I am trying to create a standard Windows Form which comprises of the following:
Button1
Button2
TextBox1
TextBox2
When the user clicks the Option1 button, I am trying to display some text held in a CString variable.
Using Visual Studio 2005, I have created the procedures for the buttons and given each TextBox one Member Variable each.
I think however I am placing some of the code in the wrong location, as when I click on Button1, the text I want displayed in the first TextBox actually becomes the label of the Button it's self.
Code:
void CSDI2Prac4Dlg::OnBnClickedButton1()
{
CString InText;
CString OutText;
CString ExtText;
InText = "Some text";
OutText = "";
ExtText = " Extended";
OutText.GetBufferSetLength(2000);
opt1.SetWindowText ( InText );
opt2.SetWindowText ( OutText );
InText = InText + ExtText;
//m_EDIT3.SetWindowText ( InText );
//OnOK();
}
void CSDI2Prac4Dlg::OnBnClickedButton2()
{
}
void CSDI2Prac4Dlg::OnEnChangeEdit1()
{
}
void CSDI2Prac4Dlg::OnEnChangeEdit2()
{
}
I am unsure how to have the "Some text" string appear in the first textbox, when the user presses Button1.
Any advice is most appreciated.