Pemrograman Visual:Acak Number: Difference between revisions
Appearance
No edit summary |
No edit summary |
||
| Line 1: | Line 1: | ||
* Desain Program | |||
[[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"> | ||
| Line 24: | Line 27: | ||
{{DISPLAYTITLE:Acak Number}} | {{DISPLAYTITLE:Acak Number}} | ||
[[Category:Materi]] | |||
[[Category:Matkul]] | |||
[[Category:Pemrograman]] | |||
[[Category:Pemrograman Visual]] | |||
Revision as of 20:03, 26 October 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