locked
change label text, VB, eg. LabelBlock.text but i cant see it it in code view RRS feed

  • Question

  • When im programming my app, i try to use 

    textblock1.text = "bah"

    But when i use that because of xaml it cant find it, can anyone help me?

    IM making an app that gets its info for a website so, it dosnt need to update very 5 secconds.

    if you want to know how i get the text...  i just use a txt file on the webserver and move the text from there into the textblock, but i cant do that because the textblock wont show up in code view
    Friday, November 22, 2013 4:11 PM

Answers

  • Hello Callum, 

    this error is right, because in your xaml file i can't find textblock1. So please put textblock  to your xaml file with name textblock1 or change any textblock x:Name property to textblock1.

    • Proposed as answer by HomeGrownCoder Saturday, November 23, 2013 7:12 AM
    • Marked as answer by Anne Jing Thursday, November 28, 2013 7:56 AM
    Saturday, November 23, 2013 4:41 AM

All replies

  • Can you show how your xaml look like for textblock1? Try using x:Name = "textblock1" inside your xaml for TextBlock control and see if that fixes your issue?

    Thanks, Sachin

    Friday, November 22, 2013 4:29 PM
  • Nooooo ;( it doesnt work for me, heres my xaml code.

    <Page
        x:Class="WS_test.MainPage"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:local="using:WS_test"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        mc:Ignorable="d" Loaded="Page_Loaded_1">
    
        <Grid Background="{StaticResource ApplicationPageBackgroundThemeBrush}">
            <TextBlock x:Name="JS_Title" HorizontalAlignment="Left" Margin="814.114,21.184,0,0" TextWrapping="Wrap" Text="JamSandwichCo" VerticalAlignment="Top" Height="78.394" Width="518.031" FontFamily="Global User Interface" FontSize="72" Foreground="#FFD61CCE" RenderTransformOrigin="0.5,0.5" UseLayoutRounding="False" d:LayoutRounding="Auto">
                <TextBlock.RenderTransform>
                    <CompositeTransform Rotation="-2.547"/>
                </TextBlock.RenderTransform>
            </TextBlock>
            <TextBlock x:Name="JS_Info" HorizontalAlignment="Left" Margin="836.206,146.84,0,0" TextWrapping="Wrap" Text="Loading Information..." VerticalAlignment="Top" Height="538" Width="503.447" Foreground="#FF1FF5FF" FontFamily="Lucida Console" FontSize="14" RenderTransformOrigin="0.5,0.5" UseLayoutRounding="False" d:LayoutRounding="Auto" IsColorFontEnabled="True">
                <TextBlock.RenderTransform>
                    <CompositeTransform Rotation="-2.946"/>
                </TextBlock.RenderTransform>
            </TextBlock>
            <MediaElement x:Name="MediaPlayer" HorizontalAlignment="Left" Height="31" Margin="203,711,0,0" VerticalAlignment="Top" Width="1137"/>
            <ToggleSwitch Header="Authentacation Server" HorizontalAlignment="Left" Margin="10,694,0,0" VerticalAlignment="Top" Width="188" FontSize="14" Height="64" OffContent="Server: OFFLINE" OnContent="Server: ONLINE" Toggled="ToggleSwitch_Toggled_1"/>
            <TextBlock x:Name="tetete" HorizontalAlignment="Left" Margin="916,284,0,0" TextWrapping="Wrap" Text="TextBlock" VerticalAlignment="Top" Height="81" Width="160"/>
        </Grid>
    </Page>
    

    Friday, November 22, 2013 10:02 PM
  • Hello Callum, 

    this error is right, because in your xaml file i can't find textblock1. So please put textblock  to your xaml file with name textblock1 or change any textblock x:Name property to textblock1.

    • Proposed as answer by HomeGrownCoder Saturday, November 23, 2013 7:12 AM
    • Marked as answer by Anne Jing Thursday, November 28, 2013 7:56 AM
    Saturday, November 23, 2013 4:41 AM