Results 1 to 5 of 5

Thread: enabled=false

  1. #1

    Thread Starter
    New Member jlangholzj's Avatar
    Join Date
    Nov 2005
    Posts
    6

    Angry enabled=false

    i am creating a millionare program using 1.0 framework and in order to rep. which dollar ammount i am on, i used a group box with radio buttons on it , but have it disabled so as the user cannont check the rad's, however i have a diff color for the milestone ammounts and with it disabled it will not show the diff colors. how can i get around this?

  2. #2
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    40,106

    Re: enabled=false

    Would it suffice to disable only the radio buttons rather than the groupbox?
    My usual boring signature: Nothing

  3. #3
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: enabled=false

    You can make your RadioButtons essentially read-only without disabling anything with code like this:
    VB Code:
    1. Private currentCheckedRadio As RadioButton 'The RadioButton that is currently checked.
    2.     Private allowCheckedChange As Boolean = True 'Whether the RadioButtons can change their Checked state.
    3.  
    4.     Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    5.         Me.RadioButton1.Checked = True
    6.         Me.currentCheckedRadio = Me.RadioButton1
    7.         Me.allowCheckedChange = False
    8.     End Sub
    9.  
    10.     Private Sub RadioButton_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton1.CheckedChanged, _
    11.                                                                                                                RadioButton2.CheckedChanged, _
    12.                                                                                                                RadioButton3.CheckedChanged
    13.         If Me.allowCheckedChange Then
    14.             'Allow the new RadioButton to be checked.
    15.             Me.currentCheckedRadio = DirectCast(sender, RadioButton)
    16.         ElseIf Not sender Is Me.currentCheckedRadio Then
    17.             'Recheck the appropriate RadioButton.
    18.             Me.currentCheckedRadio.Checked = True
    19.         End If
    20.     End Sub
    Then whenever you want to check a different one yourself you just use code like this:
    VB Code:
    1. Me.allowCheckedChange = True
    2.         Me.RadioButton2.Checked = True
    3.         Me.allowCheckedChange = False
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  4. #4

    Thread Starter
    New Member jlangholzj's Avatar
    Join Date
    Nov 2005
    Posts
    6

    Talking Re: enabled=false

    Thank you VERY MUCH!!!!! i can't stree how muck i thank you

  5. #5
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: enabled=false

    Cool. Don't forget to resolve your thread from the Thread Tools menu.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width