Results 1 to 16 of 16

Thread: How do i check all of the checks except the one i clicked

  1. #1
    bzemer
    Guest

    Question How do i check all of the checks except the one i clicked

    Hi,
    i have 5 checks, what i want to do is like this;
    when i click on a check, all of the checks goes to value=2 except the one i clicked and it becomes value=1. if i click on a different one then it's the same, all go 2 except the new one i clicked..

    i don't want to use long messy codes and i keep getting my self into loops, so is there a quick and easy way to do this..?

    thanks..

  2. #2
    Frenzied Member jjortiz's Avatar
    Join Date
    Mar 2001
    Location
    NYC
    Posts
    1,768
    why not use radio buttons.

  3. #3
    Addicted Member stevess's Avatar
    Join Date
    May 2001
    Posts
    251
    Called Option buttons these days

  4. #4
    Frenzied Member jjortiz's Avatar
    Join Date
    Mar 2001
    Location
    NYC
    Posts
    1,768
    Try this
    Do not use VbGrayed, because what happens is that the click event will fire again. Hope this helps.
    Code:
    Private Sub Check1_Click(Index As Integer)
        Dim iChkIndex As Integer
        
        iChkIndex = Index
        
        For i = 0 To Check1.UBound
            If Check1.Item(i).Index = iChkIndex Then
                Check1.Item(i).Value = vbChecked
            Else
                Check1.Item(i).Enabled = False
            End If
        Next
    End Sub

  5. #5
    Addicted Member cwm's Avatar
    Join Date
    Mar 2000
    Posts
    133
    i'd make them an array...

    check(0)
    check(1)
    check(2)
    check(3)
    check(4)

    then when you click one

    Code:
    Option Explicit
    Dim Checking As Boolean
    
    Private Sub Check_Click(Index As Integer)
    If Checking = True Then Exit Sub
    
    Checking = True
    
    Dim x As Integer
    
    For x = Check.lbound To Check.ubound
        If x <> Index Then
            Check(x).Value = 1
        Else
            Check(x).Value = 0
        End If
    Next
    
    Checking = False
    
    End Sub

  6. #6
    Frenzied Member jjortiz's Avatar
    Join Date
    Mar 2001
    Location
    NYC
    Posts
    1,768
    Vb.net called Radio buttons. jejeje
    Originally posted by stevess
    Called Option buttons these days

  7. #7
    Megatron
    Guest
    Radio Button is the correct term. Likewise, Static is the correct term for a PictureBox.

  8. #8
    Frenzied Member jjortiz's Avatar
    Join Date
    Mar 2001
    Location
    NYC
    Posts
    1,768
    Is there any Options in the programming world anymore. If microsoft can rename everything just to remarket something why can't we. jejejej Thx Megatron.

  9. #9
    Addicted Member stevess's Avatar
    Join Date
    May 2001
    Posts
    251
    In VB 5 and 6, they are called Option Buttons, the TypeOf the control is OptionButton. The default name is Option1.

    I don't care what they are called, but if someone who is just starting in VB trys to find a Radio Button control they will have a hard time, since it doesn't exist.

    "radio Button is the correct term", based on what?

  10. #10
    Frenzied Member jjortiz's Avatar
    Join Date
    Mar 2001
    Location
    NYC
    Posts
    1,768
    Every other language out there has called them radio buttons for the longest. Microsoft just renamed their Option Button to Radio button in the new version of vb. Vb.net was also redesigned to attract the c programers as well as the existing vb programmers. So guess what the now are more standardize. I know what you mean stevess, but if i was to say radio button to you, would you know what i mean? I think you would. It seems that when someone starts off with vb, they think MS rules the world, but that is not true. Yeah they have created a monster of a new vb version and i will continue to use it for its power in RAD. And because it's the most used language out there. I think there is a thread out there about this issue, but i will not go into any further.

  11. #11
    Megatron
    Guest
    VB changes the names of many controls

    Option button = Radio Button
    CommandButton = Push Button
    PictureBox/Label/Image = Static
    Frame = Group Box
    TextBox = Edit
    RichTextBox = RichEdit

  12. #12
    Addicted Member stevess's Avatar
    Join Date
    May 2001
    Posts
    251
    I would know, but based on the original question I didn't think bzemer would. I only made my original statement so that he would know what to look for
    This is a "VB" forum that attracts mostly beginners who don't know anything about other languages or that MS renamed the controls.
    I was just trying to save him some time. I thought it was likely that he would not have any idea what a radio button was

  13. #13
    Frenzied Member jjortiz's Avatar
    Join Date
    Mar 2001
    Location
    NYC
    Posts
    1,768
    It's all kewl, but guess what he now knows. One converstaion spawns another, and that is half the battle is won.

  14. #14
    bzemer
    Guest

    Exclamation WOW

    Ok, ok... i already did it with radio buttons or option buttons or whatever i know both terms.. and i just like check boxes more.. it goes well with my design.. anyways... i got it working now and the radio buttons was a good idea.. and they might be called option buttons but i did to know them as radio buttons... as a mather of fact.., microsoft's frontpage editor calls them radio buttons.. i got the term from there i guess, i built my site with frontpage, which by the way if you are by any chance into RPG it's worth a visit..

    anyway,.. again.., i could use the coeds you provided me for other stuff.. i'll save them somewere, then forget about them and ask again.. i reckon...

    nice talking to you all.. or whatever.. you did all the talking any way..

    Thanks for the help -and interest..

    BTW: see if you can help me out with this problem that i posted:
    can't get rid of that line...

  15. #15
    Tygur
    Guest
    Megatron,
    Static windows show images??
    I didn't know that.

    Also, labels aren't really windows at all. They might imitate the static window, but they aren't renamed static windows. Or did you just mean that they imitate static windows?

  16. #16
    Frenzied Member jjortiz's Avatar
    Join Date
    Mar 2001
    Location
    NYC
    Posts
    1,768
    Man Microsoft really causes havoc when ever they rename things or use name for other things. Like in the case of COM+ it's just a hyped up MTS with a new name.

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