CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: radio buttons

  1. #1
    Join Date
    May 1999
    Posts
    2

    radio buttons

    I have a propertysheet that contains three radio buttons all grouped together. does anyone know of a way to figure out which radio button has been selected and also how to get the value of that radio button. I need to save the vales to the registry so I can use them at a later date when I restart the application.

    Cheers


  2. #2
    Join Date
    May 1999
    Location
    Republic of Korea
    Posts
    74

    Re: radio buttons

    If you are using Visual C++, you can associate the radio button group to a member variable.
    Look at the Class Wizard / Member Variables section, then you may find the ID of the first
    radio button control. Associate it with an integer variable.

    When you call UpdateData(TRUE) from your dialog box, the integer value will be 0 if the first
    radio button is selected, 1 if the second is selected, and so on.



  3. #3
    Join Date
    May 1999
    Posts
    37

    Re: radio buttons

    Very easy is to find out which button is pressed:

    int id;
    id=GetCheckedRadioButton(ID_BFirst,ID_BLast);

    id will be the ID number of the checked radio button. You must ensure that the first button ID_BFirst starts a group.

    possible trouble
    Buttons must be created in the right order, otherwise you have to manage by yourself number of ID in the resource file (be carefull!!!)

    hope this will help

    Yves Le Sant
    Metrology and Measurement Unit
    Fundamental and Experimental Aerodynamics Departement
    ONERA Meudon
    (Office National d'Etudes et de Recherches Aérospatiales)
    FRANCE

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured