private void bettorComboBox_SelectedIndexChanged_1(object sender, EventArgs e) { bettor selectedbettor = (bettor)bettorComboBox.SelectedItem; int balance = selectedbettor.balance; betterBalLabel.Text = Convert.ToString(balance); }
private void gokkerAddButton_Click(object sender, EventArgs e) { if (gokkerNameTextBox.Text == "") { MessageBox.Show("Vul Aub een naam in."); } else { bettor newbettor = new bettor(); newbettor.name = gokkerNameTextBox.Text; newbettor.balance = 100; this.Result = newbettor; this.Close(); } }
public List <bettor> Load() //Bron: Docent tim: File: UsingObjects// :) Natuurlijk aan gepast naar mijn wensen { List <bettor> result = new List <bettor>(); if (!Directory.Exists(LOCATION)) { return(result); } foreach (string fileName in Directory.EnumerateFiles(LOCATION)) { string fileContent = File.ReadAllText(fileName); bettor loadedBettor = new bettor(); string[] contentLines = fileContent.Split('\n'); loadedBettor.name = contentLines[0]; loadedBettor.balance = Convert.ToInt32(contentLines[1]); result.Add(loadedBettor); } return(result); }
// niet vergeten. public void addBettor(bettor newbettor) { this.bettors.Add(newbettor); }