Login | Register   
RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.

Tip of the Day
Language: VB4,VB5,VB6
Expertise: beginner
Jul 1, 2000



Building the Right Environment to Support AI, Machine Learning and Deep Learning

Bind a group of OptionButtons to a Data control

You can't directly bind a group of OptionButton controls to a Data control, RDO Data control or ADO Data control. However, you can work around this limitation by adding an hidden TextBox control and add a few lines of code:

Private Sub optRadioButton_Click(Index As Integer)
    ' change the contents of the hidden TextBox control
    txtHidden.Text = Trim$(Index)
End Sub

Private Sub txtHidden_Change()
    ' Select the OptionButton corresponding to the value
    ' that the Data control is assigning to the hidden TextBox
    On Error Resume Next
    optRadioButton(CInt(txtHidden.Text)).Value = True
End Sub
You can use the same trick to indirectly bind any other type of control to a numeric or string database field, for example a scrollbar, the caption of a Frame, the size or position of a Shape control, the position of a Slider control, etc.
Marco Bellinaso
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date