Results 1 to 5 of 5

Thread: [RESOLVED] [2008] Stop activecontrol checkbox from becoming checked

Threaded View

  1. #1

    Thread Starter
    Member
    Join Date
    Nov 2007
    Posts
    62

    Resolved [RESOLVED] [2008] Stop activecontrol checkbox from becoming checked

    Hi all..

    Let me start out by saying my skill with vb .net is somewhere between unexperienced and slightly experienced, so don't go to hard on me

    I have around 100 checkboxes on my form and when checked or unchecked they need do something depending on the state of the checkbox.

    Looking at my code below you can see after the else statement that if the condition isn't true, I want the checkbox to remain unchecked.

    Help me out here guys..I think I need to do something with an event handler?

    Code:
        Private Sub chkAir_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles chkDustDevil.CheckedChanged, chkLightningBolt.CheckedChanged, 'etc etc
            chkboxstatus()
        End Sub
    
        Private Sub chkboxstatus()
            If ActiveControl.Tag = "c" Then
                txtCharSkillPts.Text = txtCharSkillPts.Text + txtSpellSkillPts.Text
                ActiveControl.Tag = "u"
            Else
                If txtCharSkillPts.Text >= txtSpellSkillPts.Text Then
                    txtCharSkillPts.Text = txtCharSkillPts.Text - txtSpellSkillPts.Text
                    ActiveControl.Tag = "c"
                Else
                    'don't allow checkbox to be checked
                End If
            End If
        End Sub
    Last edited by rhijaen; Feb 10th, 2008 at 02:04 AM.

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