Slt,
J'ai un petit soucis d'instance avec un objet.
Voila dans mon fichier xaml j'ai ca:
dans mon fichier c#
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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>
Le problème est le suivant : je n'ai pas de valeur pour mon textBock = Toto.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2 textX = new TextBlock(); this.textX.Text = "Toto";
Si je n'instancie pas mon textX, je n'ai pas d'erreur Visual Studio par contre j'ai une erreurComment faire ?Object reference not set to an instance of an object.
Merci d'avance








Répondre avec citation
Partager