-
Aug 7th, 2010, 08:32 PM
#1
Thread Starter
Addicted Member
Radiobutton and textbox
How can I do once I click on "textbox.text" This will select on RadioButton?
-
Aug 7th, 2010, 08:49 PM
#2
Re: Radiobutton and textbox
What?
Are you asking if the user click on a specific TextBox, then the corresponding RadioButton will be checked?
If so, handle the TextBox's Clicked event and call .Checked = True on the appropriate RadioButton.
If not, you'll need to be more clear.
CodeBank contributions: Process Manager, Temp File Cleaner
Originally Posted by SJWhiteley
"game trainer" is the same as calling the act of robbing a bank "wealth redistribution"....
-
Aug 8th, 2010, 12:36 AM
#3
Thread Starter
Addicted Member
Re: Radiobutton and textbox
i try this:
vb Code:
If TextBox1.SelectedText = True Then
RadioButton2.Checked = True
What is missing? (It does not display me an error but it does not work)
-
Aug 8th, 2010, 03:24 AM
#4
Re: Radiobutton and textbox
For us to know why your code isn't doing what you intended, we'd have to know what you intended. That's far from obvious from your code, which doesn't really make sense. In future, please take the time to post a FULL and CLEAR description of the problem. Posting a code snippet and saying it doesn't work doesn't qualify.
As for the problem, I suggest that you start by reading the documentation for the TextBox.SelectedText property. The fact that you're comparing it to a Boolean value shows that what you think it does is not what it actually does. The SelectedText property returns the part of the Text that is selected. For instance, if you type "Hello" into a TextBox and then use the mouse to highlight just the two Ls, SelectedText will return the part of the Text that is selected, i.e. "ll". If no text is highlighted then SelectedText will be an empty string. Regardless, it's a String, not a Boolean.
-
Aug 8th, 2010, 05:55 AM
#5
New Member
Re: Radiobutton and textbox
Your question isn't clear. But as far as I can understand you want to check the radiobutton when you click the textbox.
Add this to your code:
Code:
Private Sub TextBox1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox1.Click
RadioButton1.Checked=True
End Sub
If this isn't what you want then, then please explain your problem correctly.
-
Aug 8th, 2010, 06:05 AM
#6
Thread Starter
Addicted Member
Re: Radiobutton and textbox
sory my english is bad
just want to do I click on my textbox1.text and This will select a radio button
-
Aug 8th, 2010, 06:25 AM
#7
New Member
Re: Radiobutton and textbox
Originally Posted by OR444
sory my english is bad
just want to do I click on my textbox1.text and This will select a radio button
I already posted the solution in my previous post. Anyways here's it again. Add this to your code.
Code:
Private Sub TextBox1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox1.Click
RadioButton1.Checked=True
End Sub
-
Aug 8th, 2010, 07:50 AM
#8
Thread Starter
Addicted Member
Re: Radiobutton and textbox
Originally Posted by Xscapism
I already posted the solution in my previous post. Anyways here's it again. Add this to your code.
Code:
Private Sub TextBox1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox1.Click
RadioButton1.Checked=True
End Sub
Sorry
thanks a lot .. Works great!
-
Aug 8th, 2010, 07:53 AM
#9
Thread Starter
Addicted Member
Re: Radiobutton and textbox
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|