Oct 26, 2011

Making a simple calculator

0 Comment
Microsoft Visual Basic (often abbreviated as VB only) is a programming language that offers Integrated Development Environment (IDE) to create visual-based software program Microsoft Windows operating system by using a programming model (COM).

Visual Basic is a derivative of the BASIC programming language and offers computer-based software development graphs quickly.

On this occasion I will share a little knowledge about desktop programming
I'll give an example to make a simple calculator using visual basic 6.0

1. you open the Visual Basic 6.0


2. then select standart.exe only


3. make the design of the calculator by using
  • 3 Label
  • 3 TextBox
  • 4 CommandButton


Change the Caption on Label1 = number1, Label2 = angka2, Label3 = Results. Next change the name in textbox1 = txtangka1, textbox2 = txtangka2 and textbox3 = results. change is also part commandbutton1 = cmdtambah, commandbutton2 = cmdkurang, commandbutton3 = cmdkali, commandbutton4 = cmdbagi.
captionnya change so it becomes like the image below.

 
4.
Double clik on cmdtambah, cmdkurang, cmdkali and cmdbagi. then write the following coding:
  
cmdtambah :


hasil = Val(txtangka1) + Val(txtangka2)
txthasil = hasil

  
cmdkurang :


hasil = Val(txtangka1) - Val(txtangka2)
txthasil = hasil



cmdkali:


hasil = Val(txtangka1) * Val(txtangka2)
txthasil = hasil



cmdbagi :


hasil = Val(txtangka1) /Val(txtangka2)
txthasil = hasil



5.  Save Preject above with the name Calculator. select where to store your own.


6. Run or press the button (F5). and the results are as shown below.


Thus visual basic tutorial, hopefully useful apologize if there are errors.





 





0 Comment:

Post a Comment