radiobutton question

nu2vbdotnet

Member
Joined
Jan 30, 2007
Messages
7
Programming Experience
Beginner
Hi I am new here , so this might sound pretty naive.
Here is a scenario:

I run my application. I select a radiobutton. On selecting the radiobutton, "radiobutton selected" text appears in another textbox on the same form. My question is how can i deselect the already "selected button" in run time and change the text in the textbox?

Any help will be appreciated?
Thanks
 
Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
RadioButton1.Checked = True
TextBox1.Text = "hello"
End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
RadioButton1.Checked = False
TextBox1.Text = ""

End Sub
End Class
 
thanks for the suggestion Markoleo. Thats how i have been handling it . Is there any way of doing it without introducing a second button in the form??
:confused:
 
thanks for the suggestion Markoleo. Thats how i have been handling it . Is there any way of doing it without introducing a second button in the form??
:confused:

yes.
select events and choose mouse click.but mouse cursor must be in form_load.

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
RadioButton1.Checked = True
TextBox1.Text = "hello"
End Sub




Private Sub Form1_MouseClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseClick
RadioButton1.Checked = False
TextBox1.Text = ""

End Sub

this remove checked on form click.
 
Your usage in not how a radiobutton is supposed to work, it is not for select/unselect but for a choice among options. If you need checkbox to check/uncheck use a CheckBox control. If you need standard radiobuttons choices but want to provide "no selection" you add one more radiobutton choice with text "none", "unknown", "0", "empty" or similar.
 
Your usage in not how a radiobutton is supposed to work, it is not for select/unselect but for a choice among options. If you need checkbox to check/uncheck use a CheckBox control. If you need standard radiobuttons choices but want to provide "no selection" you add one more radiobutton choice with text "none", "unknown", "0", "empty" or similar.

thanks for the suggestion JohnH. Yea that would be a way to do it, but I was trying to replicate the checkbox control (check/uncheck) property for a radiobutton.
 
Back
Top