radiobutton and textbox
-
myTextBx.Enabled = true
where myTextBx is your textbox control
TOXCCT >>> GEII power
[toxcct][VisualCalc]well this is my code: - Private Sub Radiobutton1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Radiobutton1.CheckedChanged If Radiobutton1.Checked = True Then TextBox6.Enabled = True Else TextBox6.Enabled = False End If End Sub but it is not working. no errors but not working.
-
well this is my code: - Private Sub Radiobutton1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Radiobutton1.CheckedChanged If Radiobutton1.Checked = True Then TextBox6.Enabled = True Else TextBox6.Enabled = False End If End Sub but it is not working. no errors but not working.
-
set a breakpoint into the function and watch if the function is called... and watch also if it is going into the right case (maybe Radiobutton1.Checked is not set to what you think...)
TOXCCT >>> GEII power
[toxcct][VisualCalc]i'm still not able to figure out what exactly is the fault. or where things are goin wrong. is there any other way to make a textbox active other than using radiobuttons and buttons.
-
set a breakpoint into the function and watch if the function is called... and watch also if it is going into the right case (maybe Radiobutton1.Checked is not set to what you think...)
TOXCCT >>> GEII power
[toxcct][VisualCalc] -
i'm still not able to figure out what exactly is the fault. or where things are goin wrong. is there any other way to make a textbox active other than using radiobuttons and buttons.
-
hum, no, there no other way. but i thought to something : isn't your textbox into a groupbox that is itself disabled (Enabled = false) ??
TOXCCT >>> GEII power
[toxcct][VisualCalc]no it's directly on the webform.
-
try this. Private Sub RadioButton1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton14.CheckedChanged Dim rdoTemp As RadioButton = CType(sender, RadioButton) TextBox1.Enabled = rdoTemp.Checked End Sub
nope not working.
-
nope not working.
What exactly are you trying to achieve - all the code submitted in this thread works, so I suspect that you may be doing something out of the ordinary. Is a radio button the right control for you remembering that they are grouped. Perhaps a little more explanation of the task at hand may help in providing a solution that works for you.
-
What exactly are you trying to achieve - all the code submitted in this thread works, so I suspect that you may be doing something out of the ordinary. Is a radio button the right control for you remembering that they are grouped. Perhaps a little more explanation of the task at hand may help in providing a solution that works for you.
ok i'll tell you what exactly i'm trying to do. i have a dropdownlist which has a collection of various items. the user has to select anyone from it. in case the user does not find his category of items in the dropdown list then he has to click on the radiobutton which has its text as 'NOT AVAILABLE' which in turn enables the textbox and the user can type in his special category of item. and all these controls are directly on the webform.
-
ok i'll tell you what exactly i'm trying to do. i have a dropdownlist which has a collection of various items. the user has to select anyone from it. in case the user does not find his category of items in the dropdown list then he has to click on the radiobutton which has its text as 'NOT AVAILABLE' which in turn enables the textbox and the user can type in his special category of item. and all these controls are directly on the webform.
Ok. Firstly, apologies,' I didn't realize that this was web based. I am not a web person myself, but the following should work. I am sure some 'true' web people out there will come up with a more elegant solution for you. Firstly, radiobuttons do NOT cause a post back to the server by default, so you must enable this (AutoPostBack property to true) Then, you can key this code into your page_load event.
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load If Not IsPostBack Then ' ' normal code to initialise the form ' Else TextBox1.Enabled = RadioButton1.Checked End If End Sub
I am sure that you should be able to achieve the same results via some form of client side script, but as I said - I am not a web person, and the above code worked for me when I tested it !! -
Ok. Firstly, apologies,' I didn't realize that this was web based. I am not a web person myself, but the following should work. I am sure some 'true' web people out there will come up with a more elegant solution for you. Firstly, radiobuttons do NOT cause a post back to the server by default, so you must enable this (AutoPostBack property to true) Then, you can key this code into your page_load event.
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load If Not IsPostBack Then ' ' normal code to initialise the form ' Else TextBox1.Enabled = RadioButton1.Checked End If End Sub
I am sure that you should be able to achieve the same results via some form of client side script, but as I said - I am not a web person, and the above code worked for me when I tested it !!no need for apologies raph. it happens after all we are there to help each other. anyways thanx for urs time for my problem and ur involvement. i also found another way of doin it just some logical if else loops helped remove the loop holes.
-
i want to enable a textbox by clicking on a radiobutton. i mean that when i check a radiobutton1 then a textbox called textbox1 should get enabled how do i do that.