473,804 Members | 3,123 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

disable checkbox

5 New Member
hi ;)
i'm doing my intern now.this is my 1st time using ASP.NET web matrix with VB.NET language...
i need help in disabling my checkboxes.

i have 4 checkboxes, let say "air" "water" "ice" "snow"
if i check "air", i want all other 3 checkboxes to be disabled.

it's something like a objective answer sheet but i'm asked to do it with checkbox not option button..

help me please...thanx loads...

;)
Jun 13 '07 #1
6 1931
vanc
211 Recognized Expert New Member
hi ;)
i'm doing my intern now.this is my 1st time using ASP.NET web matrix with VB.NET language...
i need help in disabling my checkboxes.

i have 4 checkboxes, let say "air" "water" "ice" "snow"
if i check "air", i want all other 3 checkboxes to be disabled.

it's something like a objective answer sheet but i'm asked to do it with checkbox not option button..

help me please...thanx loads...

;)
You can write an event for checkbox's Checked. If the checkbox's Checked = true then you set the others's Enable value to False.

Cheers.
Jun 13 '07 #2
feninazman
5 New Member
this is wat i did,there are no error but my other three checkboxes which are "water" "ice" "snow" are still not disabled...and i can't use 'chkwater.Value ' cuz value is not a member...i seriously am blank rite now :(
Expand|Select|Wrap|Line Numbers
  1. Private Sub chkair_Click(sender As Object, e As System.EventArgs)
  2.    If chkair.Checked = True Then
  3.      chkwater.Enabled = False
  4.      chkice.Enabled = False
  5.      chksnow.Enabled = False
  6.    End If
  7. End Sub
  8.  
but i totally appreciate ur tip ;) thanx loads...
Jun 13 '07 #3
rhepsi
111 New Member
this is wat i did,there are no error but my other three checkboxes which are "water" "ice" "snow" are still not disabled...and i can't use 'chkwater.Value ' cuz value is not a member...i seriously am blank rite now :(

Private Sub chkair_Click(se nder As Object, e As System.EventArg s)
If chkair.Checked = True Then
chkwater.Enable d = False
chkice.Enabled = False
chksnow.Enabled = False
End If
End Sub

but i totally appreciate ur tip ;) thanx loads...


Hey Y dont u write the same code for:

CheckBox1_Check StateChanged event.........

Expand|Select|Wrap|Line Numbers
  1.  (vb)
  2. Private Sub CheckBox1_CheckStateChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles CheckBox1.CheckStateChanged
  3.  
  4.         If CheckBox1.Checked = True Then
  5.  
  6.             CheckBox2.Enabled = False
  7.             CheckBox3.Enabled = False
  8.             CheckBox4.Enabled = False
  9.  
  10.         Else
  11.  
  12.             CheckBox2.Enabled = True
  13.             CheckBox3.Enabled = True
  14.             CheckBox4.Enabled = True
  15.  
  16.         End If
  17.     End Sub
  18.  

Hope it'll work.... give a try...
Jun 13 '07 #4
vanc
211 Recognized Expert New Member
this is wat i did,there are no error but my other three checkboxes which are "water" "ice" "snow" are still not disabled...and i can't use 'chkwater.Value ' cuz value is not a member...i seriously am blank rite now :(
Expand|Select|Wrap|Line Numbers
  1. Private Sub chkair_Click(sender As Object, e As System.EventArgs)
  2.    If chkair.Checked = True Then
  3.      chkwater.Enabled = False
  4.      chkice.Enabled = False
  5.      chksnow.Enabled = False
  6.    End If
  7. End Sub
  8.  
but i totally appreciate ur tip ;) thanx loads...
In this sense, I guess you didn't add this Click event correctly. It means the event handle of the "chkair" for Click event is not associate with the handle. You should double click on "chkair" checkbox and see where it will go, if it comes to the right piece of code, then yell at me.

cheers.
Jun 14 '07 #5
rhepsi
111 New Member
In this sense, I guess you didn't add this Click event correctly. It means the event handle of the "chkair" for Click event is not associate with the handle. You should double click on "chkair" checkbox and see where it will go, if it comes to the right piece of code, then yell at me.

cheers.

Now even at the click event itz working fine...

[code.vb]

Private Sub CheckBox1_Click (ByVal sender As Object, ByVal e As System.EventArg s) Handles CheckBox1.Click
If CheckBox1.Check ed = True Then

CheckBox2.Enabl ed = False
CheckBox3.Enabl ed = False
CheckBox4.Enabl ed = False

Else
CheckBox2.Enabl ed = True
CheckBox3.Enabl ed = True
CheckBox4.Enabl ed = True
End If
End Sub
End Class

[/code]

CHEERS
Hepsi.
Jun 14 '07 #6
feninazman
5 New Member
hye guys :)

i've tried everything...bu t its still the same...its ok ;) my supervisor told me to change it using drop down list...so...new task coming up...

thanx nyway ya!!heheee...

<ginger>
Jun 14 '07 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

2
9749
by: HolaGoogle | last post by:
Hi all, Can you please tell me what's wrong with my code??? i do have this database in wich i have to field.One is a "yes/no" field and another one is "number" field. To display the yes/no field in my asp form i use a checkbox and fot he other field i use a normal text box. if the yes/no field is checked then the other field is enabled otherwise it has to be disabled.Here's what i've done so far: Do While Not ObjRS.EOF <td><input...
2
6473
by: HolaGoogle | last post by:
Can you please tell me the right way to do this?? it's realy important! thanks in advance... Hi all, Can you please tell me what's wrong with my code??? i do have this database in wich i have to field.One is a "yes/no" field and another one is "number" field. To display the yes/no field in my asp form i use a checkbox and fot he other field i use a normal text box. if the yes/no field is checked then the other field is enabled...
5
5989
by: Bob Bedford | last post by:
I create checkboxes using datas from a database (with PHP). I store all values in an array, as I must pass this value like a Form value. Now, in some cases, when a checkbox is selected, I must disactivate other checkboxes. How can I do this ? here is the code:
1
4257
by: hortoristic | last post by:
We are using JavaScript to Enable/Disable certain fields on web pages based on business rules. A simple example is if when using an option type tag, and the two options are Yes and No. If YES is selected - enable a field to use the M$ Datepicker. Using the code below works for most of our fields, however the problem is that when the field is re-enabled - it remembers the original date or data prior to it being disabled - despite the...
2
1376
by: Kekec | last post by:
I have several disabled asp:checkboxes in my table, but when i open this page in Netscape 7, Disabled property is ignored. Offcourse in IE is all perfect! Can someone help me with this one?
4
10435
by: Matrixreloadedth | last post by:
How to change disable color of Checkbox??? I have a checkbox with forecolor in red but when i disable by set Enable properties to false forecolor is changed to gray color but i don't want it. how to make disable color as the same before set enable = false Anyone can help me?????
3
18206
by: James Lennon | last post by:
Does anyone know how to disable a single check box in a Windows Forms TreeView control.
2
26377
by: Kevin | last post by:
I've been looking all over and I can't seem to find what ought to be simple. I need to disable a drop down when a checkbox is checked, and enable it when same checkbox is unchecked. I've found any number of scripts to disable / enable a drop down but they are all made to work with 2 different buttons, radio group selections, etc. I can't seem to come up with one that can toggle off a single checkbox.
3
2500
w33nie
by: w33nie | last post by:
I want to disable the text boxes, captain_name and captain_email, but only if the radio button, captain_guarantee, has NOT been checked. how do i do this? <form name="formTeamApplication" action="teams_process.php" method="post" onSubmit="validate()"> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width='75'><span class='Body'>Team Name:</span></td> <td width='150'><input width="150"...
5
11282
by: masterej | last post by:
Developers, Is there any way to disable all checkboxes on a form? I have a form with 160 checkboxes and I want to be able to disable all of them. Is there a way I can do something like this: for (int i = 0; i < 160; i++) { string checkbox = "checkBox" + i.toString(); (Cast)checkbox.enabled = false;
0
9587
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10588
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10340
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10085
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7623
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5527
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5662
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4302
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3827
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.