dimanche 4 janvier 2015

Adding numbers on label when if-statement occurs

I am making an app on windows forms application and I am stuck at a certain point.


btw, I am a very beginner in programming.


I put my code here:



if (random.Next(3) == schat)
{
using (Graphics graphics = pictureBox1.CreateGraphics())
{
graphics.DrawImage(Properties.Resources.Schat, ClientRectangle);
}

MessageBox.Show("Hoera je hebt extra geld gevonden", "zoektocht");
lblTotaalGeld.Text = Convert.ToString(100);
double totaalGeld = Convert.ToDouble(lblTotaalGeld.Text) / 100;
lblTotaalGeld.Text = Convert.ToString("€" + lblTotaalGeld.Text);



btnZoektocht.Enabled = false;
}


What I am trying to create is when this "if" statements occurs the second time.. I want the extra 100 dollars added to the bank account. At the moment I only get 100 and nothing adds.


I hope I make sense


Thanks in advance


Aucun commentaire:

Enregistrer un commentaire