By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,609 Members | 3,812 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,609 IT Pros & Developers. It's quick & easy.

how to disable textbox when click on radiobutton using VB script on Visual Studio.Net

P: 7
how to disable textbox when click on radiobutton using VB script on Visual Studio.Net 2005.

currently i used this coding but it is not functioning.


Expand|Select|Wrap|Line Numbers
  1. Private sub RadioButton1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton1.CheckedChanged
  2.  
  3.         If RadioButton1.Checked Then
  4.             Me.textBox1.Visible = True
  5.         Else
  6.             Me.textBox1.Visible = False
  7.         End If
  8.     End Sub
Mar 11 '10 #1

✓ answered by hidayu1986

i already try this code. is it that you mean?


Private Sub RadioButton1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton1.CheckedChanged
Me.TextBox3.Visible = RadioButton1.Checked
End Sub
End Class

Share this Question
Share on Google+
5 Replies


tlhintoq
Expert 2.5K+
P: 3,525
TIP: When you are writing your question, there is a button on the tool bar that wraps the [code] tags around your copy/pasted code. It helps a bunch. Its the button with a '#' on it. More on tags. They're cool. Check'em out.
Mar 11 '10 #2

tlhintoq
Expert 2.5K+
P: 3,525
I might suggest something a bit more... smooth.

Expand|Select|Wrap|Line Numbers
  1. Private sub RadioButton1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton1.CheckedChanged
  2.  
  3. Me.textBox1.Visible = RadioButton1.Checked
  4.  
  5.     End Sub
The right side of an equasion is evaluated before the left.
Thus if RadioButton1.Checked evaluates to true, then me.textBox1.Visible is set to true.
Mar 11 '10 #3

P: 7
thank u very much for your tips and your code suggestion. i already try it but it still the same not functioning when i click on radiobutton, the text box still not visible
Mar 11 '10 #4

tlhintoq
Expert 2.5K+
P: 3,525
Then you aren't running the code. It's that simple.

Are you sure you have assigned this method as the event handler to the control?

Have you put a breakpoint in (at line 3) to watch the code break on this line, to ensure it is being executed?
Mar 11 '10 #5

P: 7
i already try this code. is it that you mean?


Private Sub RadioButton1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton1.CheckedChanged
Me.TextBox3.Visible = RadioButton1.Checked
End Sub
End Class
Mar 11 '10 #6

Post your reply

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