1 Attachment(s)
VB - An ActiveX control which supplies a pair of Yes/No Option Buttons
I had occasion to write an application where a large number of Yes/No questions needed to be answered by the user. To make the coding for that project easier I wrote this little ActiveX control which is a pair of Option Buttons labeled Yes and No. I added the following four properties:
OptNoEnabled - Enable or disable the "No" choice
OptNoValue - Set the "No" value
OptYesEnabled - Enable or disable the "Yes" choice
OptYesValue - Set the "Yes" value
The code for the control is included in the zip file.
Re: VB - An ActiveX control which supplies a pair of Yes/No Option Buttons
Currently you've got the "Yes" and "No" option button captions hard-coded but with a neat little trick you can quickly localize this control to display the local language versions of "Yes" and "No".
Code:
Dim strYes as String
Dim strNo as String
Const FORMAT_STRING_YESNO As String = "Yes/No"
strYes = Format$(True, FORMAT_STRING_YESNO)
strNo = Format$(False, FORMAT_STRING_YESNO)
optYes.Caption = strYes
optNo.Caption = strNo
Re: VB - An ActiveX control which supplies a pair of Yes/No Option Buttons
That is a nice trick, so thanks and I'm adding it to my code snippets library. I don't have any plans to modify the existing code however.