0

I'm working in a GUI environment in Visual Studio 2012

void dealCard(PictureBox swag, Label swaggy)
{
    swag.Image = imageListCards->Images[deck[cardCounter].index];
    swaggy.Text = deck[cardCounter].name + " of " + deck[cardCounter].suit + ", " + deck[cardCounter].value;

    if(cardCounter == 51)
        cardCounter = 0;
    else
        cardCounter++;

}

void dealHand(PictureBox swag, PictureBox swag2, Label swaggy, Label swaggy2)
{
    dealCard(pictureBoxCard4, labelCard4);
    dealCard(pictureBoxCard5, labelCard5);
}   

pictureBoxCard4, labelCard4 etc are already in the form that I'm working with. It's not compiling the part dealCard(pictureBoxCard4, labelCard4) or the one below

Jesse Martinez
  • 403
  • 2
  • 5
  • 8
  • Jesse_BlackJack2::MyForm::dealCard' : cannot convert parameter 1 from 'System::Windows::Forms::PictureBox ^' to 'System::Windows::Forms::PictureBox' c:\users\jesse martinez\documents\visual studio 2012\projects\jesse_blackjack2\jesse_blackjack2\MyForm.h 1538 1 Jesse_BlackJack2 – Jesse Martinez May 14 '14 at 01:19
  • Do I have to use pointers or something to do what I'm trying to do? – Jesse Martinez May 14 '14 at 01:21
  • You should edit the question to include the error, and probably add the c++-cli tag for more visibility. I don't use managed C++, but I would assume from the error message that you're meant to pass those as handles. – Retired Ninja May 14 '14 at 01:30
  • You will have to learn how to use the ^ hat properly for reference types like PictureBox and Label. There are lots of tutorials and books available for C++/CLI, you don't need our help to read them. – Hans Passant May 14 '14 at 02:32

1 Answers1

0

To pass variables through functions you would have to use pointers.

Callum
  • 25
  • 1
  • 4