473,491 Members | 2,248 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

how Radio button can be combined with if else

5 New Member
If i' having three radio button and want to generate event on clicking or checking of any radio button accordingly
Jul 12 '10 #1
3 1883
GaryTexmo
1,501 Recognized Expert Top Contributor
Create an event handler in your code... the easiest way to do this is to select a radio button, go to the events page (lightning bolt in properties pane), and double-click CheckChanged.

This will automatically create an event handle for you with the signature...

Expand|Select|Wrap|Line Numbers
  1. private void SOMEMETHODNAME(object sender, EventArgs e) ...
It's important to know here that sender, while of type object, is actually the radio button that sent the event. If you cast sender to a RadioButton object, you can use it.

Expand|Select|Wrap|Line Numbers
  1. RadioButton senderRB = sender as RadioButton;
  2. if (senderRB != null)
  3. {
  4.   MessageBox.Show(senderRB.Text + " clicked!");
  5. }
Now you can go to the events pane for the other radio buttons and click the dropdown for the CheckChanged event and select the method.

In this fashion, a single event handler can be used to handle events on multiple objects.

I'm not entirely sure that's what you were looking for, but hopefully it helps. You can do similar for a RadioButton's Click event.
Jul 12 '10 #2
shweta134
5 New Member
i'm using 3 radio button and a combobox and 4 textboxes.
each time aradio button is clicked combobox vaues are changing and on selecting combox textboxes values are changing,i'm using array list concept to retrieve data from Access database.
But it is working only for the radiobutton which is clicked first on second click of other radio button it is showng "Object reference not set to an instance of an object." in splitstr = this.strArraylist[this.comboBox1.SelectedIndex].Split(delimeter, 5);
Jul 13 '10 #3
GaryTexmo
1,501 Recognized Expert Top Contributor
Using Visual Studio, set a breakpoint at that line. Try to identify which object is null. It's entirely possible that the combobox doesn't have a selected index (thus it would be -1) and you're trying to call a Split on a null string.

How are you selecting the combobox item when the radio button is pressed?

If you require further help, I think you'll need to post some code so we can see what's going on.
Jul 13 '10 #4

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

Similar topics

1
3359
by: MickG | last post by:
I am trying to change the value of the variable "hard" according to which radio button is pressed and I am having no joy. Could anyone help me with this, the problematic section is marked with...
3
2056
by: Amelyan | last post by:
When we want radio button to belong to a group name we say, radio1.GroupName="GroupA". In this case, radio1 will be unselected if another radio button is selected in "GroupA". Is there a way...
2
3455
by: NishSF | last post by:
Would anyone have any suggestions/javascript code so that if one clicks the Radio Button "Yes" below he has the option of selecting any of the six CheckBox below. If the user clicks on Radio Button...
1
2539
by: Shane | last post by:
I think that I found a bug in the Radio Button, and I wanted to give everybody a "Heads Up". I spent three days doing trial and error until I found a work around. I created a user control with a...
10
6045
by: IchBin | last post by:
I am trying to set the state of a radio button. I do not see what I am doing wrong. Sorry, I am new at this.. I need another set of eyes to look at this snip of code. I am trying to set the radio...
5
2700
by: swatidesai0407 | last post by:
hi im validating radio buttons i create dis radio button in php based on some how many records of my query. i wrote a javascript to validate this buttons. wat i do is dat wen no radio button...
3
2832
by: jahphill | last post by:
Hey. I thought id make a seperate discusion because the other became a bit lengthy and confusing. Aim: Create a php file which works with the script below, which makes the radiobuttons work =D...
8
4585
by: photoboy | last post by:
I have racked by brain long enough on this, so now I need the help of someone who knows what they are doing. Here is what I am trying to achieve: First, I have two radio buttons (both unchecked)...
8
2952
by: crayfiss | last post by:
Hi, firstly I am a total freshie in all this. From what I have gathered on the web and this forum, I finally managed to get my form up. I have a set of radio buttons with values to it and a select...
0
6978
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...
0
7190
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...
1
6858
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7360
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...
1
4881
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...
0
4578
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3086
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...
0
1392
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 ...
1
633
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.