hi,
in my example i have a datagrid and some pictureboxes. In the datagrid you can leave your name. With your name, an radiobutton gets generated. If you active your radiobutton you can "bet" on a picturebox (picturebox is moving), which one would be first on the finishline.
Now i had this example solved with arrays, but now with lists(pictureboxes and players are in a list), i dont know how to tell, ok, this radiobutton is active, so its player "jim" who wants to bet on "picbox2".
But i solved this, not on my own. Thats the problem, because i dont really understand what this code means
string name = ((RadioButton)sender).Name;
Player pl = nPlayer.FirstOrDefault(p => p.Name == name);
But this just canges a label.text into the playersname.
For this solution i have:
Class:
-Pictureboox,
-Player,
-Bet
the key funktion is a Method in the class "BET" -> Betnow()
the meth just creates a new bet, and knows on wich dog and from wich player the bet is generated.
But i cant now just tell, like i imagine: nplayer.Betnow(BettingDog, nPlayer, amount)
I have recieved some help from a friend, i know that i have to use a sort of called "Lamda" but im not sure, how this works.
Thank you
Greets Niko
ps.: let me know if you need more expressions! or sample code