TUGAS 2 PBKK C - Membuat Sistem Application Dengan .NET Framework

1. Instalasi Visual Studio Enterprise 2019


    Pertama anda harus install visual studio dulu. Setelah sudah didownload, maka install visual studio tersebut dan centang workloads ASP.NET and web development (untuk membuat website) dan .NET desktop development (untuk membuat aplikasi desktop).
    Perlu diingat bahwa anda bisa menginstall workloads sesuai kebutuhan anda, jadi tidak harus semua diinstall.

2. Hello World


    Pilih file -> new project, lalu pilih Consol App (.NET Framework), lalu klik next.


    Setelah itu beri nama project, lalu klik create. Setelah itu ketikkan kode seperti dibawah ini. 


    Jika sudah, klik start atau tekan ctrl + F5 di keyboard, maka akan keluar outputnya seperti gambar dibawah ini. 


3. Kalkulator Sederhana


    Buat project baru dengan Windows Forms App (.NET Framework) dengan bahasa Visual Basic. Bisa juga yang versi bahasa C#, tetapi disini saya menggunakan Visual Basic. Lalu klik next, beri nama project, lalu create. 
    


    Setelah itu akan muncul tampilan form kosong, lalu modifikasi form tersebut menyerupai kalkulator seperti diatas. Caranya adalah drag n drop dari toolbox dan ganti namanya di properties. Jika sudah, klik kanan formnya lalu view code, lalu isikan code seperti dibawah ini : 

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
Public Class Calculator
    Dim firstnumber As Integer
    Dim secondnumber As Integer
    Dim answer As Integer
    Dim aritmathicproccess As String

    Private Sub btn1_Click(sender As Object, e As EventArgs) Handles btn1.Click
        txtText.Text = txtText.Text & 1
    End Sub

    Private Sub btn2_Click(sender As Object, e As EventArgs) Handles btn2.Click
        txtText.Text = txtText.Text & 2
    End Sub

    Private Sub btn3_Click(sender As Object, e As EventArgs) Handles btn3.Click
        txtText.Text = txtText.Text & 3
    End Sub

    Private Sub btn4_Click(sender As Object, e As EventArgs) Handles btn4.Click
        txtText.Text = txtText.Text & 4
    End Sub

    Private Sub btn5_Click(sender As Object, e As EventArgs) Handles btn5.Click
        txtText.Text = txtText.Text & 5
    End Sub

    Private Sub btn6_Click(sender As Object, e As EventArgs) Handles btn6.Click
        txtText.Text = txtText.Text & 6
    End Sub

    Private Sub btn7_Click(sender As Object, e As EventArgs) Handles btn7.Click
        txtText.Text = txtText.Text & 7
    End Sub

    Private Sub btn8_Click(sender As Object, e As EventArgs) Handles btn8.Click
        txtText.Text = txtText.Text & 8
    End Sub

    Private Sub btn9_Click(sender As Object, e As EventArgs) Handles btn9.Click
        txtText.Text = txtText.Text & 9
    End Sub

    Private Sub btn0_Click(sender As Object, e As EventArgs) Handles btn0.Click
        txtText.Text = txtText.Text & 0
    End Sub

    Private Sub btnPlus_Click(sender As Object, e As EventArgs) Handles btnPlus.Click
        firstnumber = Val(txtText.Text)
        txtText.Text = ""
        aritmathicproccess = "+"
    End Sub

    Private Sub btnMinus_Click(sender As Object, e As EventArgs) Handles btnMinus.Click
        firstnumber = Val(txtText.Text)
        txtText.Text = ""
        aritmathicproccess = "-"
    End Sub

    Private Sub btnTimes_Click(sender As Object, e As EventArgs) Handles btnTimes.Click
        firstnumber = Val(txtText.Text)
        txtText.Text = ""
        aritmathicproccess = "x"
    End Sub

    Private Sub btnBagi_Click(sender As Object, e As EventArgs) Handles btnBagi.Click
        firstnumber = Val(txtText.Text)
        txtText.Text = ""
        aritmathicproccess = "/"
    End Sub

    Private Sub btnResult_Click(sender As Object, e As EventArgs) Handles btnResult.Click
        secondnumber = Val(txtText.Text)

        If aritmathicproccess = "+" Then
            answer = firstnumber + secondnumber
        End If

        If aritmathicproccess = "-" Then
            answer = firstnumber - secondnumber
        End If

        If aritmathicproccess = "*" Then
            answer = firstnumber * secondnumber
        End If

        If aritmathicproccess = "/" Then
            answer = firstnumber / secondnumber
        End If

        txtText.Text = answer
    End Sub

    Private Sub btnCE_Click(sender As Object, e As EventArgs) Handles btnCE.Click
        txtText.Text = ""
    End Sub
End Class








  










Komentar

Postingan populer dari blog ini

Tugas 6 - Razor Page

TUGAS 7 - Mobile Development With Xamarin