0

I want the text in a textbox "txtConvertedInches" to be selected when i press the radio button "rbFromInches".

private: System::Void rbFromInches_CheckedChanged(System::Object^  sender, System::EventArgs^  e) {
             bConvertingToInches = !rbFromInches->Checked;
             ToggleControls();
             txtConvertedInches->SelectAll(); //I thought this would do it, but nothing happens
         }
3
Contributors
3
Replies
15
Views
3 Years
Discussion Span
Last Post by Elias_3
0

This is not C++. What are the '^' tokens doing in the argument list? Also, is rbFromInches->Checked a member variable, or a method. You are using it as a variable. Finally, this is not enough code and context to know what you are doing. :-(

1

try
txtConvertedInches->Focus
this should set focus to the textbox
Cheers Milton

0

Worked perfect, Milton. Thanks!

And rubberman, I am using Visual C++ Express 2010. I thought for sure that would be C++?
And this

private: System::Void rbFromInches_CheckedChanged(System::Object^  sender, System::EventArgs^  e)

is what gets written when i double click the radio button, in a Windows Forms Application.
What i've done is i've been following a tutorial for Visual C++ Express on youtube, and after 8 videos or so i ended up with a feet and inches converter. It converts both from "feet and inches" to "inches", and from "inches" to "feet and inches", depending on which radio button is checked. The only thing that didnt work as i wanted it to in that block of code, was "txtConvertedInches->SelectAll();". But "txtConvertedInches->Focus();" work perfectly.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.