radio control

hog

Senior Contributor
Joined
Mar 17, 2003
Messages
984
Location
UK
I'm using this code to set an objects property to show if a po is internal or external, but am getting stuffed as it gets called twice, once for each control. This means even if I select external the form show internal.

It's driving me nuts and I am possibly not seeing the wood for the tress but.........help??

Visual Basic:
 Private Sub Radiobutton_CheckChanged(ByVal sender As Object, ByVal e As System.EventArgs) _
        Handles radInternal.CheckedChanged, radExternal.CheckedChanged

        If Not blnRefreshingForm And Not blnFormLoading Then

            Dim ctlSender As Control = CType(sender, RadioButton)

            Select Case ctlSender.Name

                Case "radInternal"

                    m_objContract.InternalPO = Me.radInternal.Checked
                    
                Case "radExternal"

                    m_objContract.InternalPO = Me.radExternal.Checked
                    
            End Select

            Me.cmdSave.Enabled = True
            Me.cmdAdd.Enabled = True
            Me.chkDataChanged.Checked = True

        End If

    End Sub
 
Last edited by a moderator:
If there's only two options, it's only necessary to wire up the event to one of them. After all, the event gets fired when the user has checked it, and when they have checked something else if it was previously checked.
 
Back
Top