Problem in uncheck the checkBox

Please support our VB.NET advertiser: Intel Parallel Studio Home
Reply

Join Date: Oct 2008
Posts: 1
Reputation: eswaran_mca is an unknown quantity at this point 
Solved Threads: 0
eswaran_mca eswaran_mca is offline Offline
Newbie Poster

Problem in uncheck the checkBox

 
0
  #1
Oct 13th, 2008
Hi all,

I am working in windows based application. In this application, a form contains 11 panels as 11 rows. I mean 11 panel as one by one. Each panel consits 11 checkBoxes without text only checkBoxes. if I check any one of the checkBox in any row, i need to provide a functionalites to uncheck all ohther checkBoxes if checked anyone before else the checked checkBox should be checked. if i check another one checkbox on the same row, then the previous selected checkBox should be uncheck automatically. I should not be uncheck checkbox directly. I need to achieve this by check other checkbox on the same row......

The user should not uncheck any checkboxes on the row directly. They can uncheck the checkboxes by selcecting other checkbox.

the user tries to uncheck the same checkBox dirctly by clicking on it. I need to prevent the user to uncheck the checkBox by click on the same checkbox. Instead of that the user shuld select rest of them( remainging checkBox on the same row). If the user select the second checkBox then the previus checkBox is automatically unchecked and the second checkBox is checked.

How to do that?

Thanks
RE
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 15
Reputation: Tyrone.Wilson is an unknown quantity at this point 
Solved Threads: 1
Tyrone.Wilson Tyrone.Wilson is offline Offline
Newbie Poster

Re: Problem in uncheck the checkBox

 
0
  #2
Oct 13th, 2008
how are you handling your click event? I would put a clause in there to say that if it is a user generated click then check the box again esentially undoing their uncheck immediately. perhaps someone has a more elegant way of doing it.

so:

Private Sub CheckBox1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles CheckBox1.Click
If CheckBox1.Checked = False Then
CheckBox1.Checked = True
End If
End Sub

This might help but it will also depend on whatever else you are doing in your event handlers

hope this helps. let me know how it goes
Reply With Quote Quick reply to this message  
Join Date: Oct 2008
Posts: 9
Reputation: hisheeraz is an unknown quantity at this point 
Solved Threads: 0
hisheeraz hisheeraz is offline Offline
Newbie Poster

Re: Problem in uncheck the checkBox

 
0
  #3
Oct 14th, 2008
MAYTHIS WILL HELP...
  1.  
  2. Private Sub btnNew_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnNew.Click
  3. Dim ctrl As Control
  4. Dim txt As TextBox
  5. Dim chkb As CheckBox
  6.  
  7. For Each ctrl In Me.Controls
  8. If (ctrl.GetType() Is GetType(TextBox)) Then
  9. txt = CType(ctrl, TextBox)
  10. txt.Text = ""
  11. End If
  12. If (ctrl.GetType() Is GetType(CheckBox)) Then
  13. chkb = CType(ctrl, CheckBox)
  14. chkb.Checked = False
  15. End If
  16. Next
  17. End Sub

HAVE FUN
Last edited by hisheeraz; Oct 14th, 2008 at 2:14 pm.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC