Dim a As Single, b As Single, S As Single, L As Single, K As Single
Private Sub Command1_Click()
If Not IsNumeric(Text1.Text) Then
MsgBox "harus angka broo!!"
Text1.SetFocus
Text2.Text = " "
Text1.Text = " "
Text3.Text = " "
Exit Sub
If Not IsNumeric(Text2.Text) Then
MsgBox "harus angka broo!!"
Text1.SetFocus
Text2.Text = " "
Text1.Text = " "
Text3.Text = " "
Exit Sub
If Not IsNumeric(Text3.Text) Then
MsgBox "harus angka broo!!"
Text1.SetFocus
Text2.Text = " "
Text1.Text = " "
Text3.Text = " "
Exit Sub
End If
End If
End If
If Option1.Value = True Then
List1.Clear
a = Text1.Text
b = Text2.Text
n = Text3.Text
For i = 1 To n
ui = a + (i - 1) * b
List1.AddItem "suku ke " & i & " adalah " & ui
Next i
End If
If Option2.Value = True Then
List1.Clear
a = Text1.Text
b = Text2.Text
n = Text3.Text
For i = 1 To n
ui = a * (b ^ (i - 1))
List1.AddItem "suku ke " & i & " = " & ui
Next i
End If
End Sub
Private Sub Command2_Click()
If Not IsNumeric(Text4.Text) Then
MsgBox "harus angka broo!!"
Text4.SetFocus
Text4.Text = " "
Exit Sub
End If
If Option1.Value = True Then
a = Text1.Text
b = Text2.Text
n = Text3.Text
un = a + (Text4.Text - 1) * b
Label4.Caption = "adalah " & un
End If
If Option2.Value = True Then
a = Text1.Text
b = Text2.Text
n = Text3.Text
un = a * b ^ (Text4.Text - 1)
Label4.Caption = "adalah " & un
End If
End Sub
Private Sub Command3_Click()
If Not IsNumeric(Text1.Text) Then
MsgBox "isi dulu brooo!!"
Text1.SetFocus
Text2.Text = " "
Text1.Text = " "
Text3.Text = " "
Exit Sub
If Not IsNumeric(Text2.Text) Then
MsgBox "isi dulu brooo!!"
Text1.SetFocus
Text2.Text = " "
Text1.Text = " "
Text3.Text = " "
Exit Sub
If Not IsNumeric(Text3.Text) Then
MsgBox "isi dulu brooo!!"
Text1.SetFocus
Text2.Text = " "
Text1.Text = " "
Text3.Text = " "
Exit Sub
End If
End If
End If
If Option1.Value = True Then
a = Text1.Text
b = Text2.Text
n = Text3.Text
Sn = (n / 2) * (2 * a + ((n - 1) * b))
Label5.Caption = Sn
End If
If Option2.Value = True Then
a = Text1.Text
b = Text2.Text
n = Text3.Text
Select Case b
Case b > 1
Sn = a * (b ^ n - 1) / (b - 1)
Label5.Caption = Sn
Case Else
Sn = a * (1 - b ^ n) / (1 - b)
Label5.Caption = Sn
End Select
End If
End Sub
Private Sub Command4_Click()
Text1.Text = " "
Text2.Text = " "
Text3.Text = " "
Text4.Text = " "
Text5.Text = " "
Text1.SetFocus
Label4.Caption = " "
Label5.Caption = " "
List1.Clear
End Sub
Private Sub Command5_Click()
End
End Sub
Private Sub Command6_Click()
If Not IsNumeric(Text1.Text) Then
MsgBox "isi dulu brooo!!"
Text1.SetFocus
Text2.Text = " "
Text1.Text = " "
Text3.Text = " "
Exit Sub
If Not IsNumeric(Text2.Text) Then
MsgBox "isi dulu brooo!!"
Text1.SetFocus
Text2.Text = " "
Text1.Text = " "
Text3.Text = " "
Exit Sub
If Not IsNumeric(Text3.Text) Then
MsgBox "isi dulu brooo!!"
Text1.SetFocus
Text2.Text = " "
Text1.Text = " "
Text3.Text = " "
Exit Sub
End If
End If
End If
If Option1.Value = True Then
a = Text1.Text
b = Text2.Text
n = Text5.Text
Sn = (n / 2) * (2 * a + (Text5.Text - 1) * b)
Label6.Caption = "Jumlah " & n & " suku pertama adalah " & Sn
End If
If Option2.Value = True Then
a = Text1.Text
b = Text2.Text
n = Text5.Text
Select Case b
Case b > 1
Sn = a * (b ^ n - 1) / (b - 1)
Label6.Caption = Sn
Case Else
Sn = a * (1 - b ^ n) / (1 - b)
Label6.Caption = "Jumlah " & n & " suku pertama adalah " & Sn
End Select
End If
End Sub
Private Sub Form_Load()
Label1.Visible = False
Label2.Visible = False
Label3.Visible = False
Text1.Visible = True
Text2.Visible = False
Text3.Visible = False
Text4.Visible = False
Text5.Visible = False
Text1.Text = "Pilih Salah Satu"
Label4.Visible = False
Label5.Visible = False
Label6.Visible = False
Command1.Visible = False
Command2.Visible = False
Command3.Visible = False
Command4.Visible = False
Command5.Visible = True
Command6.Visible = False
List1.Visible = False
Option1.Visible = True
Option2.Visible = True
End Sub
Private Sub Option1_Click()
List1.Clear
Label1.Visible = True
Label1.Caption = "Suku Awal"
Label2.Visible = True
Label2.Caption = "Beda"
Label3.Visible = True
Label3.Caption = "Banyak Suku"
Text1.Visible = True
Text2.Visible = True
Text3.Visible = True
Text4.Visible = True
Text5.Visible = True
Text1.Text = " "
Text2.Text = " "
Text3.Text = " "
Text4.Text = " "
Text5.Text = " "
Text1.SetFocus
Label4.Visible = True
Label4.Caption = " "
Label5.Visible = True
Label5.Caption = " "
Label6.Visible = True
Label6.Caption = " "
Command1.Visible = True
Command2.Visible = True
Command3.Visible = True
Command4.Visible = True
Command5.Visible = True
Command6.Visible = True
List1.Visible = True
End Sub
Private Sub Option2_Click()
List1.Clear
Label1.Visible = True
Label1.Caption = "Suku Awal"
Label2.Visible = True
Label2.Caption = "Rasio"
Label3.Visible = True
Label3.Caption = "Banyak Suku"
Text1.Visible = True
Text2.Visible = True
Text3.Visible = True
Text4.Visible = True
Text5.Visible = True
Text1.Text = " "
Text2.Text = " "
Text3.Text = " "
Text4.Text = " "
Text5.Text = " "
Text1.SetFocus
Label4.Visible = True
Label4.Caption = " "
Label5.Visible = True
Label5.Caption = " "
Label6.Visible = True
Label6.Caption = " "
Command1.Visible = True
Command2.Visible = True
Command3.Visible = True
Command4.Visible = True
Command5.Visible = True
Command6.Visible = True
List1.Visible = True
End Sub