Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > checkbox checked change event question

Reply
Thread Tools

checkbox checked change event question

 
 
Matthew Louden
Guest
Posts: n/a
 
      11-18-2003
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!


 
Reply With Quote
 
 
 
 
Guest
Posts: n/a
 
      11-18-2003
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!
>
>
>.
>

 
Reply With Quote
 
 
 
 
Teemu Keiski
Guest
Posts: n/a
 
      11-18-2003
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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!
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
CheckBox Checked=false when checked in DataList yurps ASP .Net 1 02-29-2008 01:08 PM
Repeater control checkbox checked event c_shah ASP .Net 5 06-15-2007 10:42 PM
checkbox checked change event question Matthew Louden ASP .Net Web Controls 1 11-18-2003 07:25 AM
Checkbox - database checkbox, if checked gives value of 1 .. how to sum ? randy Perl Misc 13 11-01-2003 05:39 AM
Capturing checked event for Template based checkbox. JemPower ASP .Net Datagrid Control 0 10-30-2003 09:31 AM



Advertisments