Pemrograman Visual:Acak Number: Difference between revisions
Appearance
No edit summary |
No edit summary |
||
| Line 2: | Line 2: | ||
[[File:Acak number 1.png|center|thumb]] | [[File:Acak number 1.png|center|thumb]] | ||
* Seluruh kode program | * Seluruh kode program | ||
<syntaxhighlight lang="vb.net" line="1"> | <syntaxhighlight lang="vb.net" line="1"> | ||
Public Class Form1 | Public Class Form1 | ||
Revision as of 20:47, 7 November 2022
- Desain Program

- Seluruh kode program
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAcak.Click
txtAngka1.Text = Int(Rnd() * 10)
txtAngka2.Text = Int(Rnd() * 10)
End Sub
Private Sub btnCekHasil_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCekHasil.Click
If Val(txtAngka1.Text) + Val(txtAngka2.Text) = Val(txtHasil.Text) Then
lblPesan.Text = "SELAMAT JAWABAN BENAR..."
Else
lblPesan.Text = "MAAF, JAWABAN SALAH..."
End If
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Randomize()
End Sub
End Class