Home All Groups Group Topic Archive Search About
Author
29 Aug 2010 2:14 AM
Abhishek
Hi,

I have 6 radio buttons (control array) on a form, the user selects the
option and click the OK button and there are two procedures in my code to
enable and disable all controls until the process is complete. but when I
disable all the radio buttons the last radio button gets automatically
selected. I dont know why its happening. there is no other code for the
radio buttons except in the DisableControls procedure.

Private Sub DisableControls()
    Dim i As Integer

    For i = 0 To optFormat.Count - 1
        optFormat(i).Enabled = False
    Next
End Sub


anyone experienced the same behavior?

Author
29 Aug 2010 2:23 AM
Abhishek
forgot to mention. i am also changing the BackColor of all those
radiobuttons at form_load

Dim I As Integer
For i = 0 To optFormat.Count - 1
    optFormat(i).BackColor = Point(0, optFormat(i).Top)
Next
Author
29 Aug 2010 2:34 AM
Randem
It would probably be better to place all the radio buttons on a frame or
picturebox then disable the container (frame or picturebox). In this way you
do not have to do each button separately. frmButton.Enable = False would
disable all buttons on the frame.

--
The Top Script Generator for Jordan Russell's Inno Setup -
http://www.randem.com/innoscript.html
Free Utilities and Code - http://www.randem.com/freesoftutil.html
Show quoteHide quote
"Abhishek" <u***@server.com> wrote in message
news:i5cfqm$dl5$1@speranza.aioe.org...
> Hi,
>
> I have 6 radio buttons (control array) on a form, the user selects the
> option and click the OK button and there are two procedures in my code to
> enable and disable all controls until the process is complete. but when I
> disable all the radio buttons the last radio button gets automatically
> selected. I dont know why its happening. there is no other code for the
> radio buttons except in the DisableControls procedure.
>
> Private Sub DisableControls()
>    Dim i As Integer
>
>    For i = 0 To optFormat.Count - 1
>        optFormat(i).Enabled = False
>    Next
> End Sub
>
>
> anyone experienced the same behavior?
>
>
Author
29 Aug 2010 9:15 AM
Nobody
Show quote Hide quote
"Abhishek" <u***@server.com> wrote in message
news:i5cfqm$dl5$1@speranza.aioe.org...
> Hi,
>
> I have 6 radio buttons (control array) on a form, the user selects the
> option and click the OK button and there are two procedures in my code to
> enable and disable all controls until the process is complete. but when I
> disable all the radio buttons the last radio button gets automatically
> selected. I dont know why its happening. there is no other code for the
> radio buttons except in the DisableControls procedure.
>
> Private Sub DisableControls()
>    Dim i As Integer
>
>    For i = 0 To optFormat.Count - 1
>        optFormat(i).Enabled = False
>    Next
> End Sub

I was able to duplicate the problem with VB6+SP5, with SP6 runtime, even if
I put them on a frame. However, if I disable the frame first, then the
options, then the problem disappears. It's interesting to note that only the
last option Click event fires, not while other options are disabled.

Another solution that I found is to use EnableWindow() API function. This
works fine whether the options are on a frame or not.

Private Declare Function EnableWindow Lib "user32" (ByVal hwnd As Long, _
    ByVal fEnable As Long) As Long

Private Sub DisableControls()
    Dim i As Integer

    For i = 0 To optFormat.Count - 1
        'optFormat(i).Enabled = False
        EnableWindow optFormat(i).hwnd, 0
    Next
End Sub
Author
29 Aug 2010 10:07 AM
Randem
Ok, but if you disable the frame there is no need to disable the options too

--
The Top Script Generator for Jordan Russell's Inno Setup -
http://www.randem.com/innoscript.html
Free Utilities and Code - http://www.randem.com/freesoftutil.html
Show quoteHide quote
"Nobody" <nob***@nobody.com> wrote in message
news:i5d8fi$j0g$1@speranza.aioe.org...
> "Abhishek" <u***@server.com> wrote in message
> news:i5cfqm$dl5$1@speranza.aioe.org...
>> Hi,
>>
>> I have 6 radio buttons (control array) on a form, the user selects the
>> option and click the OK button and there are two procedures in my code to
>> enable and disable all controls until the process is complete. but when I
>> disable all the radio buttons the last radio button gets automatically
>> selected. I dont know why its happening. there is no other code for the
>> radio buttons except in the DisableControls procedure.
>>
>> Private Sub DisableControls()
>>    Dim i As Integer
>>
>>    For i = 0 To optFormat.Count - 1
>>        optFormat(i).Enabled = False
>>    Next
>> End Sub
>
> I was able to duplicate the problem with VB6+SP5, with SP6 runtime, even
> if I put them on a frame. However, if I disable the frame first, then the
> options, then the problem disappears. It's interesting to note that only
> the last option Click event fires, not while other options are disabled.
>
> Another solution that I found is to use EnableWindow() API function. This
> works fine whether the options are on a frame or not.
>
> Private Declare Function EnableWindow Lib "user32" (ByVal hwnd As Long, _
>    ByVal fEnable As Long) As Long
>
> Private Sub DisableControls()
>    Dim i As Integer
>
>    For i = 0 To optFormat.Count - 1
>        'optFormat(i).Enabled = False
>        EnableWindow optFormat(i).hwnd, 0
>    Next
> End Sub
>
Author
29 Aug 2010 3:54 PM
Nobody
"Randem" <newsgro***@randem.com> wrote in message
news:OOMGFI2RLHA.2104@TK2MSFTNGP04.phx.gbl...
> Ok, but if you disable the frame there is no need to disable the options
> too

When I disable the frame, the options look enabled, not grayed out like
expected, however, they don't respond to user input in either case.
Author
29 Aug 2010 8:27 PM
Randem
That is exactly what it should do and I believe is exactly what you want to
happen, the user not being able to select anything.

--
The Top Script Generator for Jordan Russell's Inno Setup -
http://www.randem.com/innoscript.html
Free Utilities and Code - http://www.randem.com/freesoftutil.html
Show quoteHide quote
"Nobody" <nob***@nobody.com> wrote in message
news:i5dvrc$93s$1@speranza.aioe.org...
> "Randem" <newsgro***@randem.com> wrote in message
> news:OOMGFI2RLHA.2104@TK2MSFTNGP04.phx.gbl...
>> Ok, but if you disable the frame there is no need to disable the options
>> too
>
> When I disable the frame, the options look enabled, not grayed out like
> expected, however, they don't respond to user input in either case.
>
Author
30 Aug 2010 5:41 PM
Jeff Johnson
"Randem" <newsgro***@randem.com> wrote in message
news:%23zh%23ei7RLHA.4960@TK2MSFTNGP05.phx.gbl...

> That is exactly what it should do and I believe is exactly what you want
> to happen, the user not being able to select anything.

I disagree. Controls like radio buttons and check boxes should never LOOK
like they can accept input when they can't. If you can't click them, they
should be grayed out.
Author
31 Aug 2010 7:20 AM
Cor
"Jeff Johnson"  wrote in message
news:i5gqg8$niv$1@news.eternal-september.org...

"Randem" <newsgro***@randem.com> wrote in message
news:%23zh%23ei7RLHA.4960@TK2MSFTNGP05.phx.gbl...

>> That is exactly what it should do and I believe is exactly what you want
>> to happen, the user not being able to select anything.

>I disagree. Controls like radio buttons and check boxes should never LOOK
>like they can accept input when they can't. If you can't click them, they
>should be grayed out.

And in the dotNet forums/newsgroups I've seen that this not making visible
the disabling on a panel is seen as a feature from VB6.

I give no comment on that, I understand we have the same idea about that.

:-)

Cor
Author
31 Aug 2010 7:57 AM
Abhishek
Oh James, Why dont you be a good boy and die?


Show quoteHide quote
"Cor" <Notmyfirstn***@planet.nl> wrote in message
news:%23bFsB0NSLHA.5324@TK2MSFTNGP05.phx.gbl...
| "Jeff Johnson"  wrote in message
| news:i5gqg8$niv$1@news.eternal-september.org...
Author
31 Aug 2010 9:24 AM
Cor
"Abhishek"  wrote in message news:i5ickv$3dv$1@speranza.aioe.org...

>Oh James, Why dont you be a good boy and die?

I hope you will have a long live before you.

Cor
Author
31 Aug 2010 2:06 PM
Jeff Johnson
Show quote Hide quote
"Cor" <Notmyfirstn***@planet.nl> wrote in message
news:%23bFsB0NSLHA.5324@TK2MSFTNGP05.phx.gbl...

>>> That is exactly what it should do and I believe is exactly what you want
>>> to happen, the user not being able to select anything.
>
>>I disagree. Controls like radio buttons and check boxes should never LOOK
>>like they can accept input when they can't. If you can't click them, they
>>should be grayed out.
>
> And in the dotNet forums/newsgroups I've seen that this not making visible
> the disabling on a panel is seen as a feature from VB6.
>
> I give no comment on that, I understand we have the same idea about that.

I have a program that displays a lot of information, but users don't want to
accidentally alter that data. When they do want to, they hit an Edit button.
In normal view mode, it would be extremely ugly to have EVERYTHING disabled,
so--in direct contrast to what I said above--there ARE times that it is okay
to have unresponsive controls appear non-grayed, but I think it should be
either all or nothing, which I did not make clear in my first response.

So no, I don't think we have exactly the same idea about VB6's "feature."
What would have been nice is if there had been a Boolean property on
container objects like "PropagateDisabledStatus" so that children could be
automatically disabled--or not--when disabling the main control.
Author
31 Aug 2010 3:10 PM
Cor
Jeff,

I could answer on this (I still think we agree but I cannot explain why).

However, I don't because then we go to much about Net.

Main thing for me is, a user should somehow be able to see in his UI that
something is disabled and not think he does something wrong.

Cor

"Jeff Johnson"  wrote in message
Show quoteHide quote
news:i5j29m$e3f$1@news.eternal-september.org...

"Cor" <Notmyfirstn***@planet.nl> wrote in message
news:%23bFsB0NSLHA.5324@TK2MSFTNGP05.phx.gbl...

>>> That is exactly what it should do and I believe is exactly what you want
>>> to happen, the user not being able to select anything.
>
>>I disagree. Controls like radio buttons and check boxes should never LOOK
>>like they can accept input when they can't. If you can't click them, they
>>should be grayed out.
>
> And in the dotNet forums/newsgroups I've seen that this not making visible
> the disabling on a panel is seen as a feature from VB6.
>
> I give no comment on that, I understand we have the same idea about that.

I have a program that displays a lot of information, but users don't want to
accidentally alter that data. When they do want to, they hit an Edit button.
In normal view mode, it would be extremely ugly to have EVERYTHING disabled,
so--in direct contrast to what I said above--there ARE times that it is okay
to have unresponsive controls appear non-grayed, but I think it should be
either all or nothing, which I did not make clear in my first response.

So no, I don't think we have exactly the same idea about VB6's "feature."
What would have been nice is if there had been a Boolean property on
container objects like "PropagateDisabledStatus" so that children could be
automatically disabled--or not--when disabling the main control.
Author
31 Aug 2010 6:07 PM
Jeff Johnson
"Cor" <Notmyfirstn***@planet.nl> wrote in message
news:%230GWy6RSLHA.2068@TK2MSFTNGP05.phx.gbl...

> I could answer on this (I still think we agree but I cannot explain why).
>
> However, I don't because then we go to much about Net.
>
> Main thing for me is, a user should somehow be able to see in his UI that
> something is disabled and not think he does something wrong.

I agree, generally speaking. In the case of the program I mentioned it was
user education that let them know that even though the controls looked
"normal," they would not accept input. Another thing--which I just now
remembered since I haven't dealt with this program in a while--was that all
text fields displayed as labels unless the block was in Edit mode, so there
was that extra visual clue that the dropdowns*, check boxes, and radio
buttons were not active.


*Honestly, I might have hidden the dropdowns too and just displayed a label.
Can't remember; this program got scrapped for a Web app. Oooh, ahhh,
something new and shiny....
Author
29 Aug 2010 3:18 PM
DanS
Show quote Hide quote
"Abhishek" <u***@server.com> wrote in
news:i5cfqm$dl5$1@speranza.aioe.org:

> Hi,
>
> I have 6 radio buttons (control array) on a form, the user
> selects the option and click the OK button and there are
> two procedures in my code to enable and disable all
> controls until the process is complete. but when I disable
> all the radio buttons the last radio button gets
> automatically selected. I dont know why its happening.
> there is no other code for the radio buttons except in the
> DisableControls procedure.
>
> Private Sub DisableControls()
>     Dim i As Integer
>
>     For i = 0 To optFormat.Count - 1
>         optFormat(i).Enabled = False
>     Next
> End Sub
>
>
> anyone experienced the same behavior?

Don't disable the selected one ?
Author
29 Aug 2010 3:57 PM
Bob Butler
Show quote Hide quote
"Abhishek" <u***@server.com> wrote in message
news:i5cfqm$dl5$1@speranza.aioe.org...
> Hi,
>
> I have 6 radio buttons (control array) on a form, the user selects the
> option and click the OK button and there are two procedures in my code to
> enable and disable all controls until the process is complete. but when I
> disable all the radio buttons the last radio button gets automatically
> selected. I dont know why its happening. there is no other code for the
> radio buttons except in the DisableControls procedure.
>
> Private Sub DisableControls()
>    Dim i As Integer
>
>    For i = 0 To optFormat.Count - 1
>        optFormat(i).Enabled = False
>    Next
> End Sub

If the option buttons are the last thing to be disabled then when you get
down to the last one it gets the focus.  When an option button gets focus
and none in the group are already selected it gets selected by default. Try
re-arranging the order you disable things and make sure you do the option
buttons before at least 1 other control that can get focus.  Either that or
set a flag that you are in the disabling routine and de-select the option
button when it happens.
Author
30 Aug 2010 10:32 AM
Abhishek
Thanks,

i fixed it by using a flag.


Show quoteHide quote
"Bob Butler" <bob_butler@cox.invalid> wrote in message
news:i5e03s$ppl$1@news.eternal-september.org...
|
| "Abhishek" <u***@server.com> wrote in message
| news:i5cfqm$dl5$1@speranza.aioe.org...
| > Hi,
| >
| > I have 6 radio buttons (control array) on a form, the user selects the
| > option and click the OK button and there are two procedures in my code
to
| > enable and disable all controls until the process is complete. but when
I
| > disable all the radio buttons the last radio button gets automatically
| > selected. I dont know why its happening. there is no other code for the
| > radio buttons except in the DisableControls procedure.
| >
| > Private Sub DisableControls()
| >    Dim i As Integer
| >
| >    For i = 0 To optFormat.Count - 1
| >        optFormat(i).Enabled = False
| >    Next
| > End Sub
|
| If the option buttons are the last thing to be disabled then when you get
| down to the last one it gets the focus.  When an option button gets focus
| and none in the group are already selected it gets selected by default.
Try
| re-arranging the order you disable things and make sure you do the option
| buttons before at least 1 other control that can get focus.  Either that
or
| set a flag that you are in the disabling routine and de-select the option
| button when it happens.
|
Author
31 Aug 2010 3:19 PM
Nobody
"Bob Butler" <bob_butler@cox.invalid> wrote in message
news:i5e03s$ppl$1@news.eternal-september.org...
> If the option buttons are the last thing to be disabled then when you get
> down to the last one it gets the focus.  When an option button gets focus
> and none in the group are already selected it gets selected by default.

What's interesting is that VB is the one doing that(selecting the last
control because VB tries to shift the focus to the last enabled one). If you
disable the buttons one by one using the API function EnableWindow() like
what I showed in my first reply to this thread, then the problem doesn't
happen.
Author
29 Aug 2010 5:48 PM
Henning
Show quote Hide quote
"Abhishek" <u***@server.com> skrev i meddelandet
news:i5cfqm$dl5$1@speranza.aioe.org...
> Hi,
>
> I have 6 radio buttons (control array) on a form, the user selects the
> option and click the OK button and there are two procedures in my code to
> enable and disable all controls until the process is complete. but when I
> disable all the radio buttons the last radio button gets automatically
> selected. I dont know why its happening. there is no other code for the
> radio buttons except in the DisableControls procedure.
>
> Private Sub DisableControls()
>    Dim i As Integer
>
>    For i = 0 To optFormat.Count - 1
>        optFormat(i).Enabled = False
>    Next
> End Sub
>
>
> anyone experienced the same behavior?
>
>

I always add one more than needed, and make (0) invisible.

/Henning
Author
1 Sep 2010 12:03 PM
Dee Earley
On 29/08/2010 18:48, Henning wrote:
Show quoteHide quote
> "Abhishek"<u***@server.com>  skrev i meddelandet
> news:i5cfqm$dl5$1@speranza.aioe.org...
>> Hi,
>>
>> I have 6 radio buttons (control array) on a form, the user selects the
>> option and click the OK button and there are two procedures in my code to
>> enable and disable all controls until the process is complete. but when I
>> disable all the radio buttons the last radio button gets automatically
>> selected. I dont know why its happening. there is no other code for the
>> radio buttons except in the DisableControls procedure.
>>
>> Private Sub DisableControls()
>>     Dim i As Integer
>>
>>     For i = 0 To optFormat.Count - 1
>>         optFormat(i).Enabled = False
>>     Next
>> End Sub
>>
>> anyone experienced the same behavior?
>
> I always add one more than needed, and make (0) invisible.

This also allows an unselected default state :)

--
Dee Earley (dee.ear***@icode.co.uk)
i-Catcher Development Team

iCode Systems

(Replies direct to my email address will be ignored.
Please reply to the group.)
Author
1 Sep 2010 5:58 PM
Henning
Show quote Hide quote
"Dee Earley" <dee.ear***@icode.co.uk> skrev i meddelandet
news:%23dQSa5cSLHA.2068@TK2MSFTNGP05.phx.gbl...
> On 29/08/2010 18:48, Henning wrote:
>> "Abhishek"<u***@server.com>  skrev i meddelandet
>> news:i5cfqm$dl5$1@speranza.aioe.org...
>>> Hi,
>>>
>>> I have 6 radio buttons (control array) on a form, the user selects the
>>> option and click the OK button and there are two procedures in my code
>>> to
>>> enable and disable all controls until the process is complete. but when
>>> I
>>> disable all the radio buttons the last radio button gets automatically
>>> selected. I dont know why its happening. there is no other code for the
>>> radio buttons except in the DisableControls procedure.
>>>
>>> Private Sub DisableControls()
>>>     Dim i As Integer
>>>
>>>     For i = 0 To optFormat.Count - 1
>>>         optFormat(i).Enabled = False
>>>     Next
>>> End Sub
>>>
>>> anyone experienced the same behavior?
>>
>> I always add one more than needed, and make (0) invisible.
>
> This also allows an unselected default state :)
>
> --
> Dee Earley (dee.ear***@icode.co.uk)
> i-Catcher Development Team
>
> iCode Systems
>
> (Replies direct to my email address will be ignored.
> Please reply to the group.)

Yepp, that is the main reason. ;)

It also allows to enable/disable them from hi to lo without leaving any
active.

/Henning
Author
1 Sep 2010 6:13 PM
Bob Butler
Show quote Hide quote
"Henning" <computer_h***@coldmail.com> wrote in message
news:i5m487$q3v$1@news.eternal-september.org...
>
> "Dee Earley" <dee.ear***@icode.co.uk> skrev i meddelandet
> news:%23dQSa5cSLHA.2068@TK2MSFTNGP05.phx.gbl...
>> On 29/08/2010 18:48, Henning wrote:
>>> "Abhishek"<u***@server.com>  skrev i meddelandet
>>> news:i5cfqm$dl5$1@speranza.aioe.org...
>>>> Hi,
>>>>
>>>> I have 6 radio buttons (control array) on a form, the user selects the
>>>> option and click the OK button and there are two procedures in my code
>>>> to
>>>> enable and disable all controls until the process is complete. but when
>>>> I
>>>> disable all the radio buttons the last radio button gets automatically
>>>> selected. I dont know why its happening. there is no other code for the
>>>> radio buttons except in the DisableControls procedure.
>>>>
>>>> Private Sub DisableControls()
>>>>     Dim i As Integer
>>>>
>>>>     For i = 0 To optFormat.Count - 1
>>>>         optFormat(i).Enabled = False
>>>>     Next
>>>> End Sub
>>>>
>>>> anyone experienced the same behavior?
>>>
>>> I always add one more than needed, and make (0) invisible.
>>
>> This also allows an unselected default state :)

I usually prefer to have it visible and labelled "None" or something like
that

> Yepp, that is the main reason. ;)
>
> It also allows to enable/disable them from hi to lo without leaving any
> active.

only if the invisible one has Value=True or none of them get the focus
during the disabling process
Author
2 Sep 2010 9:44 AM
Dee Earley
On 01/09/2010 19:13, Bob Butler wrote:
Show quoteHide quote
> "Henning" <computer_h***@coldmail.com> wrote in message
> news:i5m487$q3v$1@news.eternal-september.org...
>> "Dee Earley" <dee.ear***@icode.co.uk> skrev i meddelandet
>> news:%23dQSa5cSLHA.2068@TK2MSFTNGP05.phx.gbl...
>>> On 29/08/2010 18:48, Henning wrote:
>>>> "Abhishek"<u***@server.com> skrev i meddelandet
>>>> news:i5cfqm$dl5$1@speranza.aioe.org...
>>>>> when I disable all the radio buttons the last radio button
>>>>> gets  automatically selected.
>>>>
>>>> I always add one more than needed, and make (0) invisible.
>>>
>>> This also allows an unselected default state :)
>
> I usually prefer to have it visible and labelled "None" or something
> like that

The only point I use it is in the wizard where an choice is required but
"none" is nonsensical.
The hidden one is selected initially but is hidden when any other item
is selected so it can't re get focus.

--
Dee Earley (dee.ear***@icode.co.uk)
i-Catcher Development Team

iCode Systems

(Replies direct to my email address will be ignored.
Please reply to the group.)
Author
30 Aug 2010 7:56 PM
Nando
Abhishek wrote:
Show quoteHide quote
> Hi,
>
> I have 6 radio buttons (control array) on a form, the user selects the
> option and click the OK button and there are two procedures in my code to
> enable and disable all controls until the process is complete. but when I
> disable all the radio buttons the last radio button gets automatically
> selected. I dont know why its happening. there is no other code for the
> radio buttons except in the DisableControls procedure.
>
> Private Sub DisableControls()
>      Dim i As Integer
>
>      For i = 0 To optFormat.Count - 1
>          optFormat(i).Enabled = False
>      Next
> End Sub
>
>
> anyone experienced the same behavior?

Interesting. I was able to recreated the issue under VB6+SP6 and using a
timer control to simulate some code execution. One way I fixed it was by
disabling all the controls but your "execute" button as last.

Private Sub cmdExecute_Click()

     Call EnableRadioButtons(False)
     Me.cmdRun.Enabled = False

End Sub

Alternatively you can disable all the radio buttons, but the one that's
checked last.

Private Sub EnableRadioButtons(status As Boolean)

     Dim I As Integer
     Dim J As Integer

     If (status = True) Then

         For I = 0 To optFormat.Count - 1
             optFormat(I).Enabled = True
         Next

     Else

         For I = 0 To optFormat.Count - 1

             If (optFormat(I).Value = True) Then
                 J = I
             Else
                 optFormat(I).Enabled = False
             End If
         Next

         optFormat(J).Enabled = False

     End If

End Sub

Interesting issue. It has to do with the control's active focus. -Nando
Author
31 Aug 2010 8:10 AM
Andrew
I use this routine to enable and disable controls in a container. You
could modify it to the .Visible property instead of the .Enabled and
..Forecolor properties.

I use this when I have a "master" checkbox, which in turn, enables or
disables a Frame and it's child controls. Also, Labels are greyed so
give the appearance that the Frame, and all it's controls, are disabled.

You can add other controls types as required.

Might be a starting point...


'---------------------------------------------------------------------------------------
' Procedure  : SetChildrenEnabled
' DateTime   : 10/02/2010 12:14
' Author     : Andrew
' Purpose    : Enable or Disable controls in a Frame
' Arguments  : Obj: the container Frame, State to set, Set Container
Frame enabled also?
' Returns    : none
'---------------------------------------------------------------------------------------
'
Public Sub SetChildrenEnabled(obj As Object, State As Boolean, Optional
MeToo As Boolean)
Dim Ctl As Control

   On Local Error Resume Next

    For Each Ctl In obj.Parent.Controls
       If Ctl.Container Is obj Then
          If TypeOf Ctl Is Label Then
             If State Then
                Ctl.ForeColor = QBColor(0)
             Else
                Ctl.ForeColor = QBColor(8)
             End If
          ElseIf TypeOf Ctl Is Line Then
             If State Then
                Ctl.BorderColor = QBColor(0)
             Else
                Ctl.BorderColor = QBColor(8)
             End If
          ElseIf TypeOf Ctl Is Shape Then
             If State Then
                Ctl.BorderColor = QBColor(0)
             Else
                Ctl.BorderColor = QBColor(8)
             End If
          Else
             Ctl.Enabled = State
          End If
          If MeToo Then
             obj.Enabled = State
          End If
       End If
    Next Ctl

    Err.Number = 0

End Sub


Andrew
DynoLog Dynamometer
Australia


On 29/08/2010 12:14 PM, Abhishek wrote:
Show quoteHide quote
> Hi,
>
> I have 6 radio buttons (control array) on a form, the user selects the
> option and click the OK button and there are two procedures in my code to
> enable and disable all controls until the process is complete. but when I
> disable all the radio buttons the last radio button gets automatically
> selected. I dont know why its happening. there is no other code for the
> radio buttons except in the DisableControls procedure.
>
> Private Sub DisableControls()
>      Dim i As Integer
>
>      For i = 0 To optFormat.Count - 1
>          optFormat(i).Enabled = False
>      Next
> End Sub
>
>
> anyone experienced the same behavior?
>
>