Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Radio Buttons Not working correctly

Radio Buttons Not working correctly

Scheduled Pinned Locked Moved Visual Basic
questiondata-structureslearning
5 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    JohnnyG
    wrote on last edited by
    #1

    I'm using VB6. This is probably a beginner question but I created a group of three radio buttons. They are all part of the same control array. However, in runtime mode, when one of the three buttons is clicked on, the old one that was on remains on. Thus, I end up with two radio buttons that are on/enabled. I thought VB handled this automatically. If not, how do I write code to disable/uncheck the other two radio buttons when one is activated?

    J 1 Reply Last reply
    0
    • J JohnnyG

      I'm using VB6. This is probably a beginner question but I created a group of three radio buttons. They are all part of the same control array. However, in runtime mode, when one of the three buttons is clicked on, the old one that was on remains on. Thus, I end up with two radio buttons that are on/enabled. I thought VB handled this automatically. If not, how do I write code to disable/uncheck the other two radio buttons when one is activated?

      J Offline
      J Offline
      Jeremy Falcon
      wrote on last edited by
      #2

      VB handles the WS_GROUP style when grouping automatic radio buttons. It groups by "container" controls like a frame, picture box, the main form, etc. If it's not doing it for you then make sure some of the radio buttons are not in a frame, etc. Or put all of them in a frame, etc. Jeremy Falcon Imputek "..." - Paul Watson  07-17

      J 2 Replies Last reply
      0
      • J Jeremy Falcon

        VB handles the WS_GROUP style when grouping automatic radio buttons. It groups by "container" controls like a frame, picture box, the main form, etc. If it's not doing it for you then make sure some of the radio buttons are not in a frame, etc. Or put all of them in a frame, etc. Jeremy Falcon Imputek "..." - Paul Watson  07-17

        J Offline
        J Offline
        JohnnyG
        wrote on last edited by
        #3

        This is probably a stupid question but how do I add the radio buttons to a group box. Do you draw the frame first, create option button1 within the frame, then select copy and paste it into frame as part of array element 2? or do you create the 3 options buttons first a part of a control array and then create the frame, put it over the buttons and send it to back? The reason I'm asking is cuz I had a frame around almost all of my controls and when I tried to put a frame inside of that one to group some radio buttons is when the troubles began. So, I deleted the main surrounding frame but have five radio buttons that I want into two groups/two frames.

        J 1 Reply Last reply
        0
        • J Jeremy Falcon

          VB handles the WS_GROUP style when grouping automatic radio buttons. It groups by "container" controls like a frame, picture box, the main form, etc. If it's not doing it for you then make sure some of the radio buttons are not in a frame, etc. Or put all of them in a frame, etc. Jeremy Falcon Imputek "..." - Paul Watson  07-17

          J Offline
          J Offline
          JohnnyG
          wrote on last edited by
          #4

          No matter what I do. If there are two groups of radio buttons on a form, they interfere with each other. One group works fine though.

          1 Reply Last reply
          0
          • J JohnnyG

            This is probably a stupid question but how do I add the radio buttons to a group box. Do you draw the frame first, create option button1 within the frame, then select copy and paste it into frame as part of array element 2? or do you create the 3 options buttons first a part of a control array and then create the frame, put it over the buttons and send it to back? The reason I'm asking is cuz I had a frame around almost all of my controls and when I tried to put a frame inside of that one to group some radio buttons is when the troubles began. So, I deleted the main surrounding frame but have five radio buttons that I want into two groups/two frames.

            J Offline
            J Offline
            Jeremy Falcon
            wrote on last edited by
            #5

            JohnnyG wrote: This is probably a stupid question This is not a stupid question. :) JohnnyG wrote: how do I add the radio buttons to a group box. Create the frame first. Then, directly creat the radio buttons within the fame. If you create the radio buttons first, you should notice they seem to be behind the frame instead of on top of it and are not grouped by themselves. Do note that the frame does not become the parent of the radio buttons it "encloses." The parent will still be the form. This is just VB's way of doing the logical grouping. You can override this behavior using raw Win32 API, but that is rarely needed. And, if you don't want the frame showing up during runtime, set its BorderStyle property to None. Setting Visible to False on the frame will also hide the radio buttons, and the user won't be able to see them also. Jeremy Falcon Imputek "..." - Paul Watson  07-17

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups