Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to put combo, check box, radio button

Status
Not open for further replies.

sumedha

Programmer
Apr 12, 2000
15
LK
Hi,<br>using VC++6, new to Vc++.<br>dialog based MFC application.<br><br>first<br>I have designed a combo box and entered data.<br>I want the first data item to be selected when by default, when the form loads.<br>how do you do this?<br>also how do you assign the selected item to a variable(where do you do it).<br>second<br>I have a check box. how do I get its state?(selected or not) to a variable?<br>also I have a group of three radio buttons. what are the values assign to them when selected? (0,1,2 ?)<br>sumedha<br>
 
In the OnInitDialog() method of your dialog you can do intializations.<br>You can use SetCurSel(int Index) method to select any item by default. Their are several ways to do this here i will give you one example.<br><br> int index = m_ComboBox.SetCurSel(1);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;UpdateData(FALSE);<br><br><br>You can use CWnd method in your handler for for check box<br>to check checkbox state.<br><br>int GetCheckedRadioButton( int nIDFirstButton, int nIDLastButton );<br><br>also see CWnd::CheckRadioButton&nbsp;&nbsp;<br>and&nbsp;&nbsp;CWnd::CheckDlgButton&nbsp;&nbsp;<br><br>hope this helps<br>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top