checkbox checked change event question

Discussion in 'ASP .Net' started by Matthew Louden, Nov 18, 2003.

  1. For the following code, I dont understand why "no" never appears even I
    uncheck the check in the check box.

    Private Sub CheckBox1_CheckedChanged(ByVal sender As System.Object, ByVal e
    As System.EventArgs) Handles CheckBox1.CheckedChanged
    TextBox1.Text = " "
    If (CheckBox1.Enabled) Then
    TextBox1.Text = "yes"
    Else
    TextBox1.Text = "no"
    End If
    End Sub


    Please advise. thanks!
     
    Matthew Louden, Nov 18, 2003
    #1
    1. Advertising

  2. Matthew Louden

    Guest Guest

    perhaps you want to look at the chkbox.checked property.
    This is the property which tells you if the checkbox is
    checked.

    if (checkbox1.checked) then

    >-----Original Message-----
    >For the following code, I dont understand why "no" never

    appears even I
    >uncheck the check in the check box.
    >
    >Private Sub CheckBox1_CheckedChanged(ByVal sender As

    System.Object, ByVal e
    >As System.EventArgs) Handles CheckBox1.CheckedChanged
    > TextBox1.Text = " "
    > If (CheckBox1.Enabled) Then
    > TextBox1.Text = "yes"
    > Else
    > TextBox1.Text = "no"
    > End If
    >End Sub
    >
    >
    >Please advise. thanks!
    >
    >
    >.
    >
     
    Guest, Nov 18, 2003
    #2
    1. Advertising

  3. Matthew Louden

    Teemu Keiski Guest

    You are looking for Enabled property of CheckBox whereas you should look for
    Checked property. Checked property is the one that changes when CheckBox is
    checked/unchecked.

    --
    Teemu Keiski
    MCP, Microsoft MVP (ASP.NET), AspInsiders member
    ASP.NET Forum Moderator, AspAlliance Columnist


    "Matthew Louden" <> wrote in message
    news:...
    > For the following code, I dont understand why "no" never appears even I
    > uncheck the check in the check box.
    >
    > Private Sub CheckBox1_CheckedChanged(ByVal sender As System.Object, ByVal

    e
    > As System.EventArgs) Handles CheckBox1.CheckedChanged
    > TextBox1.Text = " "
    > If (CheckBox1.Enabled) Then
    > TextBox1.Text = "yes"
    > Else
    > TextBox1.Text = "no"
    > End If
    > End Sub
    >
    >
    > Please advise. thanks!
    >
    >
     
    Teemu Keiski, Nov 18, 2003
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. yurps
    Replies:
    1
    Views:
    6,901
    rajeshthangarasu1983
    Feb 29, 2008
  2. c_shah
    Replies:
    5
    Views:
    1,152
    CitrusMotors.com
    Jun 15, 2007
  3. JemPower

    Capturing checked event for Template based checkbox.

    JemPower, Oct 30, 2003, in forum: ASP .Net Datagrid Control
    Replies:
    0
    Views:
    180
    JemPower
    Oct 30, 2003
  4. Matthew Louden

    checkbox checked change event question

    Matthew Louden, Nov 18, 2003, in forum: ASP .Net Web Controls
    Replies:
    1
    Views:
    134
    Teemu Keiski
    Nov 18, 2003
  5. randy
    Replies:
    13
    Views:
    454
    Tad McClellan
    Nov 1, 2003
Loading...

Share This Page