Adam
Adam

Reputation: 55

C# Adding values to pictureboxes

I just recently posted something earlier regarding a C# game project I am working on in Microsoft visual C# express and after trial and error the code that I have presented underneath will not work. Does anyone have any advice or help they could give me on how to get it to work? the part of the code with the brackets and asterisks and arrows is the error that will not work for me. (NOTE: I am making a Form on Microsoft Visual C# express.)

if (buttonFlag[0])
{
    return;
}

if (accept)
{
    return;
}


textBox2.Text = "";
textBox1.Text = "";
offerCounter++;

---> [[[ **pictureBox2.Image**]]]<--- = tempLabel = buttonList[0].ToString();
LostValues(tempLabel);
textBox1.Text = "-> you just opend " + tempLabel + "\n";

CallZero(tempLabel);

if (offerCounter == 20)
{
    finalValue = GetFinalValue();
    MessageBox.Show("You win " + finalValue.ToString());

    textBox1.Text = "Game is over" + "\n";
    textBox1.Text += "you won: " + finalValue.ToString();
    label16.Content = "you won:";
    label17.Content = finalValue.ToString();
    label18.Text = "Game Over";
    accept = true;
}

if (offerCounter <= 18)
{
    if ((offerCounter % 3) == 0)
    {
        GenerateNewOffer();
        textBox1.Text += "-> you have a new offer ";
        MessageBox.Show("you recieved a new offer !");
        textBox2.Text = newOffer.ToString();
    }
    else
    {
        offerRemainder = 3 - (offerCounter % 3);
        textBox1.Text += "-> Open " + offerRemainder.ToString() + "more box(es) for new offer";
    }
}
else
{
    textBox2.Text = "";
}

Upvotes: 0

Views: 497

Answers (1)

Bojin Li
Bojin Li

Reputation: 5799

The PictureBox.Image Property takes an Image instance. Read MSDN for both and code accordingly.

Upvotes: 2

Related Questions