|
-
Nov 2nd, 2000, 06:20 PM
#1
Thread Starter
Frenzied Member
Hi,
What I'm trying to do is to write some code which will treat an array
of CheckBoxes just like they were option boxes so that only 1 CheckBox
can be selected at a time. But the catch is that the user should also
be able to not have any selections which is why I'm using the CheckBox.
For example, I have a control array of 4 CheckBoxes named chkShipPay.
If index 3 is currently selected and the user clicks on index 2, 3 should be unchecked
and 2 should be checked. If the user then clicks 2 again, it should be unchecked.
I tried various code in the click event but it allways seems to go in an infinite
loop and terminates..
Any help or ideas would be greatly appreciated..
Dan
-
Nov 2nd, 2000, 06:25 PM
#2
Fanatic Member
Try this:
Not Tested!!!
Code:
Private Sub chkShipPay_Click (Index As Integer)
Dim chk as CheckBox
For Each chk In chkShipPay
chk.Value = 0
Next
chkShipPay(Index).Value = 1
End Sub
GWDASH
[b]VB6, Perl, ASP, HTML, JavaScript, VBScript, SQL, C, C++, Linux , Java, PHP, MySQL, XML[b]
-
Nov 2nd, 2000, 07:06 PM
#3
Thread Starter
Frenzied Member
Thanks, but doesn't work either.. It also goes into an infinite loop. Also, even if your code were to work, it wouldn't allow for "deselecting" a checkbox.. There would allways be 1 checked.. But remember, I want to also allow the user the option of not making any selections or deselecting an already selected option..
-
Nov 2nd, 2000, 07:26 PM
#4
Why not have options buttons. If you want the choice of having no items selected, make a "None" option.
-
Nov 2nd, 2000, 07:58 PM
#5
Fanatic Member
Sorry, I wasn't thinking, go with Megatron
GWDASH
[b]VB6, Perl, ASP, HTML, JavaScript, VBScript, SQL, C, C++, Linux , Java, PHP, MySQL, XML[b]
-
Nov 2nd, 2000, 09:17 PM
#6
Thread Starter
Frenzied Member
Okay, Megatron's suggestion will work.. I thought about that but just wanted to see if I could make it work but I guess it won't be simple..
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|