coding visual adot.net

codingang visual adot.net

1. ) perkalian.

Public Class Form2
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
h = TextBox1.Text
b = TextBox2.Text
Call hitung()
TextBox3.Text = hasil
End Sub
End Class

Dengan model :

Module Module1
'variabel public
Public nama As String, hasil, h, b As Integer
Sub tampilnama()
   nama = "Heri Padli"
End Sub
Sub hitung()
   hasil = Val(h) * Val(b)
End Sub
End Module


2. ) habis dibagi 9 dan 27

Public Class Form1

    Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress

    End Sub

    Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged

    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim j, u, y As Integer
        u = 9
        y = 27
        For j = 1 To Val(TextBox1.Text)
            If j Mod u = 0 Then
                ComboBox1.Items.Add(j)
                u = j
            Else
                If j Mod y = 0 Then
                    ComboBox1.Items.Add(j)
                    y = j
                End If
            End If
        Next
    End Sub

    Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged

    End Sub
End Class

Komentar

Postingan populer dari blog ini

HARI ESOK ITU HADIAH