Designing a Calculator in Visual Basic 2013 Part 1

We have shown you how to design a calculator in Visual Basic 6. Now we wish to demonstrate how to create a calculator in Visual basic 2013. First of all, design the interface of the calculator as shown below;
calculatorFirst, Insert a label to be used as display panel for the calculator. Next, insert ten number buttons and change the text from 0 to 9. Finally, insert the buttons to be used as arithmetic operators and other functions such as backspace.

Now, we shall show you how to display the numbers on the display panel. Write the following code to response to clicks from the user on the number buttons. Write the code by double clicking on any number button, here we use the button with number 1.

Private Sub Btn1_Click(sender As Object, e As EventArgs) Handles Btn0.Click, Btn1.Click, Btn2.Click, Btn3.Click,
Btn4.Click, Btn5.Click, Btn6.Click, Btn7.Click, Btn8.Click, Btn9.Click

If LblPanel.Text = “0” Then LblPanel.Text = “”
LblPanel.Text += sender.text

End Sub

This code with display numbers on the display panel.

We will show you how to write other codes in next article.