i am try to write a code for a checkbox that work like a radioButton dynamicaly in vb.net. i.e. if i have 5 check box and i try to check the first one other will become unchecked.
Second with same code if i increase the number of check box in the Form same code will work for that also.
i try this code but it not good ..............
Private Sub CheckBox1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox1.CheckedChanged
If CheckBox1.Checked = True Then
CheckBox2.Checked = False
Private Sub CheckBox2_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox2.CheckedChanged
If CheckBox2.Checked = True Then
CheckBox1.Checked = False
Add to form load event
'tell each checkbox to use the same handler for the CheckedChange event For Each cb As CheckBox In Me.Controls.OfType(Of CheckBox)() AddHandler cb.CheckedChanged, AddressOf CheckBox_CheckedChanged Next
Add this sub to the form class:
Private Sub CheckBox_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) 'create a checkbox that equals the one being checked. Dim TempCB As CheckBox = DirectCast(sender, CheckBox) If TempCB.Checked Then For Each cb As CheckBox In Me.Controls.OfType(Of CheckBox)() 'uncheck all the other checkboxes If Not cb.Name = TempCB.Name Then cb.Checked = False End If Next End If End Sub
This will do what you describe, only one checkbox at a time can be checked. This will work for however many you want.
Hi I'm having a problem implementing a mini shopping cart drop down in the header to show the user all the products they have in their shopping cart. It seems the only solution for this is Ajax, and I've looked all over and can't find anything that I could possibly ...
Hello All ...
Iam Getting An Error With try to excecute the stored procedure .
I have Have Sql database , the stored procedure like so :
USE [MPRS] GO /****** Object: StoredProcedure [dbo].[Search_Licenses_By_Number] Script Date: 26-Nov-16 8:06:52 AM ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO ALTER PROCEDURE ...
Help! I want to create a java program that finds the highest even integer among the values entered by the user. Stop asking values when a value less than 1 have been entered. If no even integer is entered, display "No Even Integer"
Here is the sample output that I ...