Membuat Aplikasi Menggunakan Visual Basic

Membuat Aplikasi Visual Basic : Program Konversi Suhu




Gambar Program Konversi Suhu.

#Contoh Scriptnya :


Public Class Form1

    Sub rumus()
        
        If Option1.Checked = True And Option4.Checked = True Then
            Text1.Text = Text2.Text
        ElseIf Option1.Checked = True And Option5.Checked = True Then
            Text2.Text = Val(Text1.Text) * 4 / 5
        ElseIf Option1.Checked = True And Option6.Checked = True Then
            Text2.Text = (Val(Text1.Text) * 9 / 5) + 32
        End If
        If Option2.Checked = True And Option5.Checked = True Then
            Text1.Text = Text2.Text
        ElseIf Option2.Checked = True And Option4.Checked = True Then
            Text2.Text = Val(Text1.Text) * 5 / 4
        ElseIf Option2.Checked = True And Option6.Checked = True Then
            Text2.Text = (9 / 4 * Val(Text1.Text)) + 32
        End If
        If Option3.Checked = True And Option6.Checked = True Then
            Text1.Text = Text2.Text
        ElseIf Option3.Checked = True And Option5.Checked = True Then
            Text2.Text = 5 / 9 * (Val(Text1.Text) - 32)
        ElseIf Option3.Checked = True And Option4.Checked = True Then
            Text2.Text = 4 / 9 * (Val(Text1.Text) - 32)
        End If

    End Sub


    Private Sub Option1_CheckedChanged(sender As Object, e As EventArgs) Handles Option1.CheckedChanged
        Call rumus()
    End Sub

    Private Sub Option2_CheckedChanged(sender As Object, e As EventArgs) Handles Option2.CheckedChanged
        Call rumus()
    End Sub

    Private Sub Option3_CheckedChanged(sender As Object, e As EventArgs) Handles Option3.CheckedChanged
        Call rumus()
    End Sub

    Private Sub Option4_CheckedChanged(sender As Object, e As EventArgs) Handles Option4.CheckedChanged
        Call rumus()
    End Sub

    Private Sub Option5_CheckedChanged(sender As Object, e As EventArgs) Handles Option5.CheckedChanged
        Call rumus()
    End Sub

    Private Sub Option6_CheckedChanged(sender As Object, e As EventArgs) Handles Option6.CheckedChanged
        Call rumus()
    End Sub

    Private Sub Text1_TextChanged(sender As Object, e As EventArgs) Handles Text1.TextChanged
        Call rumus()
    End Sub

    Private Sub Caption_Click(sender As Object, e As EventArgs) Handles Caption.Click
        End
    End Sub

    

    Private Sub Caption2_Click(sender As Object, e As EventArgs) Handles Caption2.Click
        Text1.Clear()
        Text2.Clear()
        Option1.Checked = False
        Option2.Checked = False
        Option3.Checked = False
        Option4.Checked = False
        Option5.Checked = False
        Option6.Checked = False
    End Sub
End Class


  • Digg
  • Del.icio.us
  • StumbleUpon
  • Reddit
  • RSS