943,781 Members | Top Members by Rank

Ad:
  • VB.NET Discussion Thread
  • Unsolved
  • Views: 3245
  • VB.NET RSS
Oct 13th, 2008
0

Problem in uncheck the checkBox

Expand Post »
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
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
eswaran_mca is offline Offline
1 posts
since Oct 2008
Oct 13th, 2008
0

Re: Problem in uncheck the checkBox

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
Reputation Points: 10
Solved Threads: 1
Light Poster
Tyrone.Wilson is offline Offline
25 posts
since Aug 2008
Oct 14th, 2008
0

Re: Problem in uncheck the checkBox

MAYTHIS WILL HELP...
VB.NET Syntax (Toggle Plain Text)
  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.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
hisheeraz is offline Offline
9 posts
since Oct 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in VB.NET Forum Timeline: Convert Video file to Thumbnails
Next Thread in VB.NET Forum Timeline: can someone help me with this problem with arrays?





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC