2nd Share for Visual Basic

Keep on to second application

It is called Simple calc

In this application, we will learn about getting value and calculate it to be information.

This is the interface view

Here is the source code

</pre>
Public Class Form1

Private val1 As Integer

Private val2 As Integer

Function getVal1() As Integer

val1 = txtVal1.Text

Return val1

End Function

Function getVal2() As Integer

val2 = txtval2.Text

Return val2

End Function

Private Sub btplus_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btplus.Click

lblhasil.Text = getVal1() + getVal2()

End Sub

Private Sub btmin_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btmin.Click

lblhasil.Text = getVal1() - getVal2()

End Sub

&nbsp;

Private Sub btmulti_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btmulti.Click

lblhasil.Text = getVal1() * getVal2()

End Sub

&nbsp;

Private Sub btper_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btper.Click

lblhasil.Text = getVal1() / getVal2()

End Sub

&nbsp;

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

txtVal1.Text = ""

txtval2.Text = ""

lblhasil.Text = ""

End Sub
<pre>End Class

Tagged:

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: