473,670 Members | 2,618 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

disabling controls by checking off a radio button when the form loads

Hi,
I have 2 radio buttons on my Windows form control. The radio button's
CheckedChanged event disables or enables other controls on the form based on
the value of the Checked property.
When the form loads, I want to check off one of the radio buttons. So I
put the code to check off my radio button in the form's load event. But the
CheckedChanged even is not firing.

Private Sub ActivityList_Lo ad(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load

' check the Unscheduled Activity radio button

rdoUnscheduledA ctivity.Checked = True

End Sub

This code is not firing the CheckedChanged event of the radio button.

Any help will be appreciated.

Thanks in advance...
Mar 31 '06 #1
8 2078
Only thing I can think of is if rdoUnscheduledA ctivity's Checked property is
set to True at the design time then in Form Load event setting it again to
True will not fire that event.
Mar 31 '06 #2
Hi,

You did not post the code that you're using as a handler for your
CheckedChanged event.

Two possible reasons come to my mind, which might explain the problem :

1. The Eventhandler is not wired to the Event. i.e., the method
Private Sub rdoUnscheduledA ctivity_Checked Changed() does not have a
Handles clause to connect it to the event.

2. If the radio button is already checked and you set it's checked
property to True, the CheckedChanged event won't fire. Though, in this
case, it probably won't be possible, since even if you set the Checked
property of the Radio button to True in Design mode, the event will
still fire when InitializeCompo nent sets that setting. (Pardon the long
sentence.)

Regards,

Cerebrus.

Mar 31 '06 #3
"Cerebrus" <zo*****@sify.c om> wrote in message
news:11******** **************@ u72g2000cwu.goo glegroups.com.. .
Hi,

You did not post the code that you're using as a handler for your
CheckedChanged event.

Two possible reasons come to my mind, which might explain the problem :

1. The Eventhandler is not wired to the Event. i.e., the method
Private Sub rdoUnscheduledA ctivity_Checked Changed() does not have a
Handles clause to connect it to the event.

2. If the radio button is already checked and you set it's checked
property to True, the CheckedChanged event won't fire. Though, in this
case, it probably won't be possible, since even if you set the Checked
property of the Radio button to True in Design mode, the event will
still fire when InitializeCompo nent sets that setting. (Pardon the long
sentence.)


Actually, #2 is possible. The Designer sets properties before adding event
handlers in InitializeCompo nent.
Apr 1 '06 #4
Please note that crossposting is considered rude. Please note that this has
nothing to do with the C# programming language. When crossposting any of
your problems again, please omit the csharp group.
Thanks.

"helpful sql" <no****@stopspa m.com> wrote in message
news:%2******** ********@TK2MSF TNGP11.phx.gbl. ..
Hi,
I have 2 radio buttons on my Windows form control. The radio button's
CheckedChanged event disables or enables other controls on the form based
on the value of the Checked property.
When the form loads, I want to check off one of the radio buttons. So I
put the code to check off my radio button in the form's load event. But
the CheckedChanged even is not firing.

Private Sub ActivityList_Lo ad(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load

' check the Unscheduled Activity radio button

rdoUnscheduledA ctivity.Checked = True

End Sub

This code is not firing the CheckedChanged event of the radio button.

Any help will be appreciated.

Thanks in advance...

Apr 1 '06 #5
Hi James,
Actually, #2 is possible. The Designer sets properties before adding event
handlers in InitializeCompo nent.


Could you elaborate on how #2 is possible ? I actually tried this. I
set the Checked property to True in Design mode. Then implemented an
Event handler for the CheckedChanged event. I then set breakpoints
within the InitializeCompo nent, where the property is set, and within
the Eventhandler.

As I have mentioned, the program breaks within the Initialize
component, and even before proceeding to the next line, the
CheckedChanged event is raised.

Regards,

Cerebrus.

Apr 1 '06 #6
"Cerebrus" <zo*****@sify.c om> wrote in message
news:11******** **************@ i39g2000cwa.goo glegroups.com.. .
Hi James,
Actually, #2 is possible. The Designer sets properties before adding
event
handlers in InitializeCompo nent.


Could you elaborate on how #2 is possible ? I actually tried this. I
set the Checked property to True in Design mode. Then implemented an
Event handler for the CheckedChanged event. I then set breakpoints
within the InitializeCompo nent, where the property is set, and within
the Eventhandler.

As I have mentioned, the program breaks within the Initialize
component, and even before proceeding to the next line, the
CheckedChanged event is raised.


I did what you did and the event isn't raised. Looking at my
InitializeCompo nent(), I can't see how it could.

private void InitializeCompo nent()
{
// snip
this.radioButto n1.Checked = true;
// snip
this.radioButto n1.CheckedChang ed += new
System.EventHan dler(this.radio Button1_Checked Changed);
// snip
}

If I hand-modify it and move the latter statement before the former, then
the event goes off. But as it is, no go.

Apr 1 '06 #7
"James Park" <fa******@fakea ddress.com> wrote in message
news:43******** *************** ***********@mic rosoft.com...
"Cerebrus" <zo*****@sify.c om> wrote in message
news:11******** **************@ i39g2000cwa.goo glegroups.com.. .
Hi James,
Actually, #2 is possible. The Designer sets properties before adding
event
handlers in InitializeCompo nent.


Could you elaborate on how #2 is possible ? I actually tried this. I
set the Checked property to True in Design mode. Then implemented an
Event handler for the CheckedChanged event. I then set breakpoints
within the InitializeCompo nent, where the property is set, and within
the Eventhandler.

As I have mentioned, the program breaks within the Initialize
component, and even before proceeding to the next line, the
CheckedChanged event is raised.


I did what you did and the event isn't raised. Looking at my
InitializeCompo nent(), I can't see how it could.

private void InitializeCompo nent()
{
// snip
this.radioButto n1.Checked = true;
// snip
this.radioButto n1.CheckedChang ed += new
System.EventHan dler(this.radio Button1_Checked Changed);
// snip
}

If I hand-modify it and move the latter statement before the former, then
the event goes off. But as it is, no go.


Whoops. Totally missed that the OP is using VB. I saw the thread from the
csharp group and made a bad assumption.

Apr 1 '06 #8
>>Whoops. Totally missed that the OP is using VB. I saw the thread from the
csharp group and made a bad assumption.


Ah ! I suspected as much...

So Lebesgue's comments about cross-posting to newsgroups seem even more
appropriate.

Regards,

Cerebrus.

Apr 1 '06 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
9358
by: Matthew Louden | last post by:
why need to set autopostback property to be true?? I know autopostback event means to send the form to the server automatically. I tried checkbox, checkbox list, radio button, and radio button list, and they all need to set autopostback property to be true, in order to make the event of the control fires. I know this is the must, but I dont know why. Please advise! Thanks!
1
1632
by: john | last post by:
I have two different problems: 1. When the user has clicked on a button that is causing the browser to post back to the server, it could take a little while for the new page to show up. So in the mean time, I want to change the cursor to an hourglass and disable all of the controls on the form using javascript so the user can't do anything with any of the controls on the page. But when I disable certain controls (e.g. text boxes, radio...
3
3973
by: Leo J. Hart IV | last post by:
OK, here's another question for the experts: I am building a multi-step (3 steps actually) form using a panel for each step and hiding/displaying the appropriate panel/panels depending on which step you're on. This all works fine, but I ran into some trouble when I started creating controls dynamically in my code-behind file. Each panel contains a table which is filled with various radio buttons, text fields and the such which are...
1
8835
by: Jerry | last post by:
We have a 10-question quiz for kids, each question being a yes or no answer using radio selections. I'd like to keep a current total of yes's and no's at the bottom of the quiz (if the user selects yes to question 1, the total of yes's increases by 1). I've been searching for a while but I'm not sure I'm searching with the right keywords. Can anyone direct me to a source I can review to learn how to do this? Thanks! --
2
6303
by: dougawells | last post by:
Hi- I'm wanting to have a set of radio buttons disabled when a form is displayed, then if they check another specific radio button, those would become enabled. I've tried setting it via window.document.formname.radiogroup.disabled="true"; (or false) - but that doesn't seem to work. I've seen this done with text boxes, but not with radio buttons. Can anyone give any help? Thanks
8
1268
by: helpful sql | last post by:
Hi, I have 2 radio buttons on my Windows form control. The radio button's CheckedChanged event disables or enables other controls on the form based on the value of the Checked property. When the form loads, I want to check off one of the radio buttons. So I put the code to check off my radio button in the form's load event. But the CheckedChanged even is not firing. Private Sub ActivityList_Load(ByVal sender As System.Object, ByVal e As...
7
2524
by: nathaniel.k.lee | last post by:
Is it not possible, in IE, to dynamically click a radio button? I'm grabbing some values from a database and using them to populate radio buttons on a page. I have alternate code for Firefox browsers using the setAttribute() function. Everything works as planned in Firefox but in IE, the buttons won't populate and, what's worse, I can't even click on them after everything loads. I see the slight shadow that indicates you're clicking on a...
0
2398
by: Mike Collins | last post by:
I someone can please help, I am about at an end in trying to figure this out. I am adding some dynamic controls to my page (I found out that I was supposed to be doing that in the oninit event, which I am). I now want to read the text/values of those controls. I have found out that I can read the values if I wait until Page_Load, but then I have the same questions showing up again (along with the new questions) and I do not want them to....
1
2243
by: Suma | last post by:
Hi, i have a problem with the controls .i have to validate Form1 Radio button option is checked or Not in the Form2. even after checking the radio button also in FOrm2 it is always taking as "False" only. please see the following code where i did wrong. I ahve created A Visual C# .Net project. for that i ahve added Form2 now my project contains Form1 and Form2. In Form1 i have placed Control "RadioButton1"
0
8386
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
8814
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
8660
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...
0
7415
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6213
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
5683
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4209
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...
1
2799
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
2041
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.