Salut à tous !
donc j'essaie de me remettre au C# avec une application Windows Forms, et je n'arrive même pas a compiler un truc super simple
ça me dégoute un peu donc je viens posé la question ici après quelques recherches peu fructueuses sur la chose, car admettons le, je ne comprend pas trop l'erreur... donc je ne sais pas trop sur quoi chercher!
Donc voilà mon simple petit bout de code tout ridicule qui me pose problème:`
Il plante dès la ligne
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60 using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; public class Character { public Wealth Wealth { get; set; } public Class Class { get; set; } public Stats Stats { get; set; } } public class Stats { public int Str { get; set; } public int Dex { get; set; } public int Con { get; set; } public int Wis { get; set; } public int Int { get; set; } public int Cha { get; set; } public int HP { get; set; } } public class Wealth { public int Platinium { get; set; } public int Gold { get; set; } public int Silver { get; set; } public int Copper { get; set; } } public class Class { public int ClassID { get; set; } public int Level { get; set; } public int HD { get; set; } } namespace Pathfinder_Character_Generator { public partial class FCharacter : Form { public FCharacter() { InitializeComponent(); Character Current = new Character(); Current.Stats.Str = 18; Current.Stats.Dex = 16; Current.Stats.Con = 14; Current.Class.Level = 12; Current.Class.HD = 10; Current.Stats.HP = (Current.Class.HD + ((Current.Stats.Con - 10) / 2)) * Current.Class.Level; LblHP.Text = Current.Stats.HP.ToString(); } } }avec l'erreur
Code : Sélectionner tout - Visualiser dans une fenêtre à part Current.Stats.Str = 18;
qui me parle autant qu'une phrase en dialecte chinois de fond de campagneLa référence d'objet n'est pas définie à une instance d'un objet.
Donc j'aimerais juste comprendre ce que j'ai fais de pas correct là-dedans, car apparemment mon visual studio aime pas ca
Amuny,
Partager