Bug in Radio Button (or weird feature)

S

Shane

I think that I found a bug in the Radio Button, and I wanted to give
everybody a "Heads Up". I spent three days doing trial and error until
I found a work around.

I created a user control with a text box and two radio buttons. The
text box has the TabStop = True, and both radio buttons have TabStop =
False. The radio buttons are set to false so that a Tab (or captured
Enter) may tab to the next control. The appropriate radio button is set
depending if the text is negative or non-negative.

Here's the bugs:
1) Setting the TabStop property for the radio buttons in the user
control did not always hold the False value. If you go into the
designer code, there is no override code for setting the property. The
control will use its default of True.

2) Inserting the TabStop property setting in the design code would also
not stay. Very frustrating. There was much cursing.

3) Here's the Rosetta stone for the first two problems ... If you
programmatically change the checked radio button, the TabStop for the
radio button is apparently set back to True! Perhaps Microsoft
considers this to be a "feature", but I can't imagine why.

The workaround was to simply set both radio buttons back to false,
immediately after I changed the checked value. This seems to work,
although a bit heavy handed on the programming side.

If m_dblCode > 0 Then
OptCheck.Checked = True
ElseIf m_dblCode < 0 Then
optDebit.Checked = True
Else
If m_IsCheckDefault Then
OptCheck.Checked = True
Else
optDebit.Checked = True
End If
End If
optDebit.TabStop = False
OptCheck.TabStop = False
 
?

=?ISO-8859-1?Q?G=F6ran_Andersson?=

According to the documentation the default is false, not true.

Also, the very first thing that the documentation says about the
property might gives a clue to why you have trouble using it:

"This property supports the .NET Framework infrastructure and is not
intended to be used directly from your code."
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top