-
Apr 9th, 2006, 12:19 PM
#1
Thread Starter
Member
[RESOLVED] One click selection
For 2 command bottons in a form, let's say "yes" or "no", how to make it as a single switch selection, so that it chooses "yes" or "no" alternatively and I can just make a single click to comfirm the selection?
Thanks for answering.
-
Apr 9th, 2006, 12:31 PM
#2
Re: One click selection
You can have two option buttons (say optYes and optNo) and check which one is selected:
VB Code:
Private Sub Command1_Click()
Select Case True
optYes.Value
'do something
optNo.Value 'OR use Case Else (if you only have 2 options)
'do something else
End Select
End Sub
-
Apr 9th, 2006, 12:40 PM
#3
Re: One click selection
..or you could use 2 option buttons with Graphical style. They will look just like a command button.
-
Apr 9th, 2006, 12:52 PM
#4
Thread Starter
Member
Re: One click selection
Sorry for I did not make my question clear.
For the 2 buttons, I want them to be something like flashing alternatively, maybe 1 sec interval, "yes" is highlighted when "no" is normal and vice versa.
For selection, I want the selection only depends on a single click, no matter where the cursor is, so command1_click may not be useful.
-
Apr 9th, 2006, 01:13 PM
#5
Re: One click selection
To have the slection with just one click, you need grouped controls (just like option button, whre either one can be selected, but not both).
For for "flashing" stuff, you need some timer-stuff the change the the presentation, but I'm not sure what you really want to show.
You're welcome to rate this post!
If your problem is solved, please use the Mark thread as resolved button
Wait, I'm too old to hurry!
-
Apr 9th, 2006, 01:17 PM
#6
Re: One click selection
Originally Posted by opus
... I'm not sure what you really want to show.
I don't have a clue either...
-
Apr 9th, 2006, 01:32 PM
#7
Thread Starter
Member
Re: One click selection
Originally Posted by opus
To have the slection with just one click, you need grouped controls (just like option button, whre either one can be selected, but not both).
Sorry I cannot get your meaning since I am still a learner of programming, can you give more details on this?
Originally Posted by opus
For for "flashing" stuff, you need some timer-stuff the change the the presentation, but I'm not sure what you really want to show.
I want to present it with changing the backcolor of button, with timer to control the frequency. Stuff like Command1.BackColor = &H8000000D
-
Apr 9th, 2006, 02:03 PM
#8
Re: One click selection
try this, add 2 command buttons and 1 timer:
VB Code:
Private Sub Form_Load()
Command1.Caption = "Yes"
Command2.Caption = "No"
Command1.BackColor = vbGreen
Timer1.Interval = 1000
Timer1.Enabled = True
End Sub
Private Sub Timer1_Timer()
If Command1.BackColor = vbGreen Then
Command2.Enabled = True
Command2.BackColor = vbRed
Command1.BackColor = vbNormal
Command1.Enabled = False
Else
Command1.Enabled = True
Command2.Enabled = False
Command1.BackColor = vbGreen
Command2.BackColor = vbNormal
End If
End Sub
Harsh
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
|