Latihan 3 Menggunakan IIF pada VB.NET
Berikut Source Code nya :
Public Class latihan3
'nadiahtami 2017230007
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim hari As String
Dim ke As String = ComboBox1.Text
hari = IIf(ke = "1", "SENIN", IIf(ke = "2", "SELASA",
IIf(ke = "3", "RABU", IIf(ke = "4", "KAMIS",
IIf(ke = "5", "JUMAT", IIf(ke = "6", "SABTU", "MINGGU"))))))
TextBox1.Text = hari
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Application.Exit()
End Sub
End Class
Latihan 4 Menggunakan Select Case pada VB.NET
Berikut Source Code nya :
Public Class latihan4
'nadiahtami2017230007'
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim bil As Integer = TextBox1.Text
Select Case bil
Case 80 To 100
TextBox2.Text = "A"
Case 65 To 79
TextBox2.Text = "B"
Case 47 To 64
TextBox2.Text = "C"
Case 26 To 46
TextBox2.Text = "D"
Case Else
TextBox2.Text = "E"
End Select
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Application.Exit()
End Sub
End Class
Komentar
Posting Komentar