Radio button problem

Hi guys, I seem to have a small problem with my windows form application. Upon starting up the program, I need to click a radio button in the windows form even though it appears as toggled before the program would work properly. Is it possible to find a way to make it toggled automatically when I start the program? Another method is that I can make it appear not active at all so the user will know to click it. The code is below.

1
2
3
4
5
6
void CzebraDlg::OnBnClicked01()
{
	// TODO: Add your control notification handler code here
	sprintf(Person, "01"); //write "A" to Person
	NumName=1;
}


I can't really see anything in the "properties" that I can use. Is there a fix?I'm using MFC for the GUI creation. Thanks a lot in advance.

P.S. Thanks a lot to siavoshkc for helping me with my previous problem.
Override the CzebraDlg::OnInitDialog() method and select the radio button there. If you created the app with the MFC wizard, there should already be a body in your zebraDlg.cpp file. Put it after the base class call. It should look something like this:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
BOOL CzebraDlg::OnInitDialog()
{ 
    //Call the base method
    if (!CDialog::OnInitDialog())
    { 
        return FALSE;
    }

    //Set the radio button to selected
    m_myButton.SetCheck(BST_CHECKED);

    // ... other initialization ...

    return TRUE;
}


If you didn't use the app wizard, put this in the CzebraDlg definition:

1
2
public:
    virtual BOOL OnInitDialog();
Topic archived. No new replies allowed.