Petite question de débutant Instance d'Objet
Slt,
J'ai un petit soucis d'instance avec un objet.
Voila dans mon fichier xaml j'ai ca:
Code:
1 2 3 4 5
| <StackPanel Name="MyStackPanel" Orientation="Vertical" Margin="20,15,20,15">
<StackPanel Orientation="Horizontal" Margin="0,0,0,6">
<TextBlock Name="textX" Foreground="#FFFFFFFF" FontSize="12" FontStyle="Italic" FontFamily="Portable User Interface" />
</StackPanel>
</StackPanel> |
dans mon fichier c#
Code:
1 2
| textX = new TextBlock();
this.textX.Text = "Toto"; |
Le problème est le suivant : je n'ai pas de valeur pour mon textBock = Toto.
Si je n'instancie pas mon textX, je n'ai pas d'erreur Visual Studio par contre j'ai une erreur
Citation:
Object reference not set to an instance of an object.
Comment faire ?
Merci d'avance