How do I get the text out of a System.Windows.Controls.TextBox in a Windows Application Form?

I need to have spellcheck available for users in my windows application.  I inserted a WPF Interoperability ElementHost onto my form and used this code to set it up.  It works great.

Added:
using System.Windows;
using System.Windows.Controls;

References:
PresentationCore
PresentationFramework

Code to get it working:
 var memoBox = new System.Windows.Controls.TextBox();
memoBox.SpellCheck.IsEnabled = true;
 txtMemoField.Child = memoBox;


Now I need to save what is typed in the elementhost.  Here is my code:
tblS.MemoField = Convert.ToString(this.txtMemoField.Child);

This retrieves:  "System.Windows.Controls.TextBox:  what's been typed"

I just want "what's been typed."   How do I do code for this because I can see it in there (all by itself) when I debug, I just can't get it.

Many thanks!
Karen WilsonProgrammerAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Peter HutchisonSenior Network Systems SpecialistCommented:
You need to use the .Text property of the textbox to get the text out of it.
0
Karen WilsonProgrammerAuthor Commented:
That does not work.  Tried it...  If I use this.txtMemoField.Text I get "".  I use child, at least I get something.  Now I need to drill down in child to get just the text.
0
Mike TomlinsonMiddle School Assistant TeacherCommented:
Try using .Text() against the CHILD?

    tblS.MemoField = Convert.ToString(this.txtMemoField.Child.Text);
0
Angular Fundamentals

Learn the fundamentals of Angular 2, a JavaScript framework for developing dynamic single page applications.

Karen WilsonProgrammerAuthor Commented:
I just get TextInput as a choice.  I typed it in as well to see what happened and it didn't like it.  When I drill down, I open the System. Windows.Controls.TextBox, I can see it all by itself under Text.
0
Mike TomlinsonMiddle School Assistant TeacherCommented:
*I don't work in WPF...sorry.

You may need to CAST the child to its proper type before you can see the .Text() property.  

Maybe?
tblS.MemoField = ((System.Windows.Controls.TextBox)this.txtMemoField.Child).Text.ToString();

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Karen WilsonProgrammerAuthor Commented:
And there it is!!  THANKS!!!!!!!!!!!!!!!!  I knew I'd get the answer from you!!  

Have a great day....
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C#

From novice to tech pro — start learning today.