Je suis nouveau à la programmation en VB.NET et je ne sais pas comment ByRef et ByVal pourraient travailler dans une partie de ce code Blackjack! Merci!Comment rendre ce programme plus efficace en utilisant ByVal et ByRef?
Voici une partie du code:
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
If hit = 0 Then
getCard()
PictureBox3.Image = cImg(n)
playertotal += value
If playertotal > 21 And pAce >= 1 Then
pAce -= 1
playertotal -= 10
End If
End If
If hit = 1 Then
getCard()
PictureBox4.Image = cImg(n)
playertotal += value
If playertotal > 21 And pAce >= 1 Then
pAce -= 1
playertotal -= 10
End If
End If
If hit = 2 Then
getCard()
PictureBox5.Image = cImg(n)
playertotal += value
If playertotal > 21 And pAce >= 1 Then
pAce -= 1
playertotal -= 10
End If
End If
hit += 1
Label2.Text = playertotal
If Label2.Text > 21 Then
Label11.Text = "COMPUTER WINS!"
End If
If hit = 3 And playertotal <= 21 Then
Label11.Text = "PLAYER WINS!"
End If
End Sub
double possible de [ByVal et ByRef avec le type de référence] (http: // stackoverflow. com/questions/19707622/byval-and-byref-with-reference-type) – cokeman19
Pourquoi pensez-vous que vous devriez changer et la signature de l'événement? – Plutonix
Faut-il utiliser byRef ou byVal? – ElenaDBA