1. PEMBUATAN NPM
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim i, j As Integer
For j = 2005 To 2011
tahun.Items.Add(j)
Next j
For i = 110 To 250
limit.Items.Add(i)
Next i
jurusan.Items.Add("S1")
jurusan.Items.Add("D3")
End Sub
Private Sub hapus_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles hapus.Click
tahun.Text = ""
jurusan.Text = ""
limit.Text = ""
npm.Text = ""
End Sub
Private Sub keluar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles keluar.Click
Close()
End Sub
Private Sub tahun_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tahun.SelectedIndexChanged
If jurusan.Text = "S1" Then
npm.Text = Microsoft.VisualBasic.Right(tahun.Text, 2) & "11" & Microsoft.VisualBasic.Right(limit.Text, 3)
ElseIf jurusan.Text = "D3" Then
npm.Text = Microsoft.VisualBasic.Right(tahun.Text, 2) & "03" & Microsoft.VisualBasic.Right(limit.Text, 3)
End If
End Sub
Private Sub limit_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles limit.SelectedIndexChanged
If jurusan.Text = "S1" Then
npm.Text = Microsoft.VisualBasic.Right(tahun.Text, 2) & "11" & Microsoft.VisualBasic.Right(limit.Text, 3)
ElseIf jurusan.Text = "D3" Then
npm.Text = Microsoft.VisualBasic.Right(tahun.Text, 2) & "03" & Microsoft.VisualBasic.Right(limit.Text, 3)
End If
End Sub
Private Sub jurusan_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles jurusan.SelectedIndexChanged
If jurusan.Text = "S1" Then
npm.Text = Microsoft.VisualBasic.Right(tahun.Text, 2) & "11" & Microsoft.VisualBasic.Right(limit.Text, 3)
ElseIf jurusan.Text = "D3" Then
npm.Text = Microsoft.VisualBasic.Right(tahun.Text, 2) & "03" & Microsoft.VisualBasic.Right(limit.Text, 3)
End If
End Sub
Private Sub npm_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles npm.SelectedIndexChanged
End Sub
End Class
2. PEMBUATAN FUNGSI
Public Class Form1
Private Sub cmdproses_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdproses.Click
Dim fx, x As Integer
x = -1
fx = x ^ 3 - x ^ 2 + 3 * x + 2
While (fx) > 0.1
x = x + 0.1
fx = x ^ 3 - x ^ 2 + 3 * x + 2
End While
kotak.Items.Add(fx)
End Sub
End Class