Designing a Calculator in Visual Basic 2013

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.

 

 

Google+Sina WeiboGoogle GmailYahoo MailPrintLinkedInPinterestTumblrQQShare

Creating a Drawing Pad using Visual Basic 6

We can create a simple virtual drawing pad using Visual Basic 6 .In this program, the user just needs to fill in coordinates of the starting point and the ending point and chooses a color in order to draw the required shape. If he or she forgets to fill in the coordinates or chooses a color, he or she will be prompted to do so.

To create the drawing pad, you need to insert a common dialog control, a picture box, four text boxes , six command buttons and the necessary labels. The function of the common dialog control is to assist the users to choose colors. The text boxes are for the user to enter the coordinates and the picture box is to display the pictures drawn.

Read More

Google+Sina WeiboGoogle GmailYahoo MailPrintLinkedInPinterestTumblrQQShare

Creating Arrays in Visual Basic 2013

What is an Array? In visual Basic 2013, an array is a group of variables(elements) with the same data type . When we work with a single item, we only need to use one variable. However, if we have a list of items which are of similar type to deal with, we need to declare an array of variables instead of using a variable for each item

For example, if we need to enter one hundred names, it is very tedious to declare one hundred different names, this is a waste of time and efforts. So, instead of declaring one hundred different variables, we need to declare only one array. We differentiate each item in the array by using subscript, the index value of each item, for example name(1), name(2),name(3) …….etc. , which will make declaring variables streamline and much more systematic.

Read More………………

Google+Sina WeiboGoogle GmailYahoo MailPrintLinkedInPinterestTumblrQQShare