Wrox Programmer Forums
|
BOOK: Ivor Horton's Beginning Visual C++ 2013
This is the forum to discuss the Wrox book Ivor Horton's Beginning Visual C++ 2013 by Ivor Horton; ISBN: 978-1-118-84571-4
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Ivor Horton's Beginning Visual C++ 2013 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 22nd, 2016, 06:43 PM
Registered User
 
Join Date: Mar 2016
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Setting the Text in a TextBlock

I have created a small test Windows Store app. I am testing it on both Windows 10 and the Windows 10 Core on a Raspberry Pi 2B. The program, as written, runs just fine. However I want to change the text in a TextBlock to the value of an integer (read from a sensor) when the user presses a button. I can certainly change the text in the TextBlock to a different text constant, as in:

<TextBlock Grid.Row="1" x:Name="AccumulatorDisplay" Text="0" TextWrapping="NoWrap" TextAlignment="Center" VerticalAlignment="Stretch" HorizontalAlignment="Stretch"
FontSize="25"/>

AccumulatorDisplay->Text = "13";

But what I want to accomplish is something like:

char szBuffer[32];
int iSensorReading;

// Read the sensor value into iSensorReading...

_itow_s(SensorReading, szBuffer1, 32, 10);
AccumulatorDisplay->Text = szBuffer1;

That is, I want to set the text in my AccumulatorDisplay to the text value of the SensorReading. I have not found a way to do it, and there does not appear to be anything in Chapter 18 to give me a hint.

Thank you for your time and consideration!





Similar Threads
Thread Thread Starter Forum Replies Last Post
TextBlock wrapping of text in Silverlight XAML file. Bill_Thompson Silverlight 4 0 September 11th, 2011 11:14 PM
Setting up a text field jaycee Word VBA 1 August 23rd, 2010 11:48 AM
Setting up Full-Text Indexing Aaron Edwards SQL Server ASP 0 July 2nd, 2006 01:32 PM
Setting backGround Colour of a text pazzuzu C++ Programming 0 January 21st, 2005 11:15 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.