Reputation: 49
I am trying to display only the desired country came under the particular flag. But when I change the Radio Button and change the selection of Check Box it does not work and after first selection it is displaying all the countries names..
//Code for Option Buttons
Public Class Form1
Private Sub RadioButton1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PKFlag.CheckedChanged
PakFlag.Visible = PKFlag.Checked
End Sub
//Code for Check Boxes
Private Sub CH_KW_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CH_KW.CheckedChanged
If KuwaitFlag.Checked = True And CH_KW.Checked = True Then
LBL_KW.Visible = True
Else
LBL_KW.Visible = False
End If
End Sub
Upvotes: 0
Views: 60
Reputation: 6385
Try to create a sub like this:
Private Sub AdjustVisibleName()
LBL_KW.Visible = (KuwaitFlag.Checked = True AndAlso CH_KW.Checked = True)
'Exactly the same for the other countries
End Sub
Then in the CheckedChanged event handler for every checkbox and radiobutton you call this function. That way you can make sure that the displayed name is always up to date.
Upvotes: 1