XAMLファイルの場合:
tbWithNoName
まず、たとえば私が与えたTextBlockに名前を付ける必要があります。
<TextBlock x:Name="tbWithNoName" HorizontalAlignment="Left" TextWrapping="Wrap" Padding="6" VerticalAlignment="Center" Margin="45,0,0,0" Height="30" Width="386" Text="My Program ver. Version"/>
次に、WindowオブジェクトにLoaded呼び出しを追加します。
<Window x:Class="MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525"
Loaded="Window_Loaded">
Window_Loaded関数をvbファイルに挿入します。
Private Sub Window_Loaded(sender As Object, e As RoutedEventArgs)
tbWithNoName.Text = tbWithNoName.Text + " " + Version
End Sub
これにより、ウィンドウが読み込まれたときにTextBlockのテキストが変更されます