Results 1 to 7 of 7

Thread: Cheak boxes .value help

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Dec 2005
    Posts
    124

    Cheak boxes .value help

    basically i've got two chk boxes. one called chkExtension and one called chkSpecialEvent.

    When chkSpecailEvent is turned on (i.e. the tick is put in thier) both chkExtension and chkSpecialEvent must be checked.

    when When chkSpecailEvent is turned off(i.e. the tick is taken out) both chkExtension and chkSpecialEvent must not be checked.

    When chkExtension is turned on (i.e. the tick is put in thier) chkExtension must stayon, while chkSpecailEvent is turned off.

    When chkExtension is turned okk(i.e. the tick is taken out) chkExtension must stayon, while chkSpecailEvent is turned off.

    Okay i hope thats clear. now i'm using this code

    VB Code:
    1. Private Sub chkExtension_Click()
    2.     If chkExtension.Value = True Then
    3.         chkSpecialEvent.Value = False
    4.         chkExtension.Value = False
    5.     ElseIf chkExtension.Value = False Then
    6.         chkSpecialEvent.Value = False
    7.         chkExtension.Value = True
    8.     End If
    9. End Sub
    10.  
    11. Private Sub chkSpecialEvent_Click()
    12.     If chkSpecialEvent.Value = 1 Then
    13.         chkSpecialEvent.Value = 0
    14.         chkExtension.Value = 0
    15.     ElseIf chkSpecialEvent.Value = 0 Then
    16.         chkSpecialEvent.Value = 1
    17.         chkExtension.Value = 1
    18.     End If
    19.    
    20. End Sub

    but when i run it, it says out of stack? not a clue what that means. could anyone help me?

  2. #2

  3. #3
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431

    Re: Cheak boxes .value help

    Looking at your requirements closely shows that they are contradictory.

    The first two basically say that the value of chkExtension must be the same as the value of chkSpecialEvent, while the next two contradict that.

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Dec 2005
    Posts
    124

    Re: Cheak boxes .value help

    if chkSpecialEvent is on, then chkExtension must be on

    chkExtension can be on while chkSpecialEvent is off

    but if chkSpecialEvent is tured off then chkExtension must be tured off at the same time

    does that make more sence?

  5. #5
    PowerPoster
    Join Date
    Oct 2002
    Location
    British Columbia
    Posts
    9,758

    Re: Cheak boxes .value help

    Make use of the third possible State (vbGrayed) for the Value property and disable chkExtension when chkSpecialEvent is checked.

    Try this code to see if it gives you the functionality you want.

    VB Code:
    1. Private Sub chkExtension_Click()
    2.     If chkExtension.Value = vbChecked Then
    3.         chkSpecialEvent.Value = vbUnchecked
    4.     End If
    5. End Sub
    6.  
    7. Private Sub chkSpecialEvent_Click()
    8.     If chkSpecialEvent.Value = vbChecked Then
    9.         chkExtension.Value = vbGrayed
    10.         chkExtension.Enabled = False
    11.     Else
    12.         chkExtension.Value = vbUnchecked
    13.         chkExtension.Enabled = True
    14.     End If
    15. End Sub

    If you don't want to disable chkExtension use this code.

    VB Code:
    1. Private Sub chkExtension_Click()
    2.     If chkExtension.Value = vbChecked Then
    3.         chkSpecialEvent.Value = vbUnchecked
    4.     ElseIf chkSpecialEvent.Value = vbChecked Then
    5.         chkExtension.Value = vbGrayed
    6.     End If
    7. End Sub
    8.  
    9. Private Sub chkSpecialEvent_Click()
    10.     If chkSpecialEvent.Value = vbChecked Then
    11.         chkExtension.Value = vbGrayed
    12.     Else
    13.         chkExtension.Value = vbUnchecked
    14.     End If
    15. End Sub
    Last edited by brucevde; Mar 14th, 2006 at 01:26 PM.

  6. #6

    Thread Starter
    Lively Member
    Join Date
    Dec 2005
    Posts
    124

    Re: Cheak boxes .value help

    reply, thanks a lot, yes that did give me what i wanted. thanks a lot.

    do you think the user would think they can't click the icon while its greyed?

  7. #7
    Software Carpenter dee-u's Avatar
    Join Date
    Feb 2005
    Location
    Pinas
    Posts
    11,127

    Re: Cheak boxes .value help

    Usually when a control is greyed it means it is disabled, computer users I think have this general thought...
    Regards,


    As a gesture of gratitude please consider rating helpful posts. c",)

    Some stuffs: Mouse Hotkey | Compress file using SQL Server! | WPF - Rounded Combobox | WPF - Notify Icon and Balloon | NetVerser - a WPF chatting system

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