This is a migrated thread and some comments may be shown as answers.
Problem getting text from a TextBox
3 Answers 25 Views
This is a migrated thread and some comments may be shown as answers.
Ricardo
Top achievements
Rank 1
Ricardo asked on 19 Dec 2011, 08:15 PM
Hello everyone!

I'm having some problems getting the text on a TextBox, it keeps saying it's empty when it's not. Basically, I'm filling in a contact form, saving it and then reopening the contact's details (which opens the same form) and trying to get the text from the TextBox's.

Since the object is originally is an ITextBox, I tried casting the object to TextBox, FrameworkElement and also not casting it at all and still no good... The "TextContent" property is empty and the "Text" doesn't exist (throws an exception).

Unfortunately, it's not possible to make the app available to the outside due to company's policy...

Best regards,
Ricardo

3 Answers, 1 is accepted

Sort by
0
Jonas
Top achievements
Rank 2
answered on 20 Dec 2011, 08:17 AM
Hello Ricardo,

I've had the same issue, but only on some textboxes in grids.
My sollution was to first click in the textbox (turns out that a border was above the textbox, when i clicked it then my TextBox appeared), then i could read the ITextBox object as text.

One of my example:

var myTextBox = rutin.ItemTextbox;

var myBorderThatIsBlocking = rutin.ItemBorder;

myBorderThatIsBlocking.User.Click();

Assert.AreEqual(inputText, myTextBox.Text);


This helped me, perhaps it can help you aswell.

//Jonas
0
Ricardo
Top achievements
Rank 1
answered on 20 Dec 2011, 11:45 AM
Although that wasn't the solution, thank you very much for your reply Jonas! :)

The problem was that the "TextBox" was afterall an "ExtendedTextBox", which seems to have different behaviors.

Best regards,
Ricardo
0
Anthony
Telerik team
answered on 20 Dec 2011, 07:15 PM
@Ricardo
We're glad you sorted out your issue. Please post again if you require further assistance.

@Jonas
Thank you for offering assistance. Your Telerik Points have been updated accordingly.

Regards,
Anthony
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Asked by
Ricardo
Top achievements
Rank 1
Answers by
Jonas
Top achievements
Rank 2
Ricardo
Top achievements
Rank 1
Anthony
Telerik team
Share this question
or